Return ( true ) // Exit user-defined function If ( Lots_New AccountFreeMargin ()) // It isn't enough even. Lots_New = MathFloor ( Free * Percent/ 100 /One_Lot/ Step ) * Step //Calc If ( Money 100 ) // Preset, but incorrectly. If ( Lots > 0 ) // Volume is explicitly set.ĭouble Money = Lots * One_Lot // Order cost amount of lotsĭouble Step = MarketInfo ( Symb, MODE_LOTSTEP ) //Step in volume changingĭouble Free = AccountFreeMargin () // Free margin - 2 -ĭouble One_Lot = MarketInfo ( Symb, MODE_MARGINREQUIRED ) //!-lot costĭouble Min_Lot = MarketInfo ( Symb, MODE_MINLOT ) // Min. false - if there is no enough money for the minimum volume true - if there is enough money for the minimum volume int Percent - free margin percentage defined by the user double Lots - the desired amount of lots defined by the user. double Lots_New - the amount of lots for new orders (calculated) Function calculating the amount of lots. The code should be used for educational purpose only. The function Lot() that determines the amount of lots is formed as include file Lot.mqh: //. If the function Inform() is not included in the EA, no messages will be displayed. To display message, the function uses the data function Inform().
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |