A hydraulic power generating system comprising: a hydraulic motor; a bidirectional generator connected to the hydraulic motor, for rotating or swinging in a first direction or a second direction by the hydraulic motor to generate electricity, the bidirectional generator comprising: a stator structure comprising a stator body and a plurality of stator coils, a plurality of stator slots being formed on the stator body, the plurality of stator coils being wrapped around the plurality of stator slots; and a rotor structure comprising a rotor body disposed in the stator body in a swingable or rotatable manner, a plurality of rotor slots being formed on the rotor body; the hydraulic power generating system further comprising: a hydraulic cylinder having hydraulic oil contained therein; a piston structure having a piston, a first link, and a second link, the piston being movably disposed in the hydraulic cylinder to divide the hydraulic cylinder into a first chamber and a second chamber, the first link and the second link being connected to two ends of the piston, respectively, and the first link and the second link being disposed through the first chamber and the second chamber, respectively; a first tube communicated with the first chamber and the hydraulic motor; a second tube communicated with the second chamber and the hydraulic motor; and a power driving device connected to one of the first link and the second link, for driving the piston to move back and forth in the hydraulic cylinder via the one of the first link and the second link; wherein when the power driving device drives the piston to move toward the first chamber, the hydraulic cylinder pumps the hydraulic oil to the hydraulic motor through the first tube for rotating or swinging the bidirectional generator in the first direction by the hydraulic motor; when the power driving device drives the piston to move toward the second chamber, the hydraulic cylinder pumps the hydraulic oil to the hydraulic motor through the second tube for rotating or swinging the bidirectional generator in the second direction by the hydraulic motor. a hydraulic motor; a bidirectional generator connected to the hydraulic motor, for rotating or swinging in a first direction or a second direction by the hydraulic motor to generate electricity, the bidirectional generator comprising: a stator structure comprising a stator body and a plurality of stator coils, a plurality of stator slots being formed on the stator body, the plurality of stator coils being wrapped around the plurality of stator slots; and a rotor structure comprising a rotor body disposed in the stator body in a swingable or rotatable manner, a plurality of rotor slots being formed on the rotor body; a stator structure comprising a stator body and a plurality of stator coils, a plurality of stator slots being formed on the stator body, the plurality of stator coils being wrapped around the plurality of stator slots; and a rotor structure comprising a rotor body disposed in the stator body in a swingable or rotatable manner, a plurality of rotor slots being formed on the rotor body; a hydraulic cylinder having hydraulic oil contained therein; a piston structure having a piston, a first link, and a second link, the piston being movably disposed in the hydraulic cylinder to divide the hydraulic cylinder into a first chamber and a second chamber, the first link and the second link being connected to two ends of the piston, respectively, and the first link and the second link being disposed through the first chamber and the second chamber, respectively; a first tube communicated with the first chamber and the hydraulic motor; a second tube communicated with the second chamber and the hydraulic motor; and a power driving device connected to one of the first link and the second link, for driving the piston to move back and forth in the hydraulic cylinder via the one of the first link and the second link; wherein when the power driving device drives the piston to move toward the first chamber, the hydraulic cylinder pumps the hydraulic oil to the hydraulic motor through the first tube for rotating or swinging the bidirectional generator in the first direction by the hydraulic motor; when the power driving device drives the piston to move toward the second chamber, the hydraulic cylinder pumps the hydraulic oil to the hydraulic motor through the second tube for rotating or swinging the bidirectional generator in the second direction by the hydraulic motor.