This is not “recommended code”. That is a function definition. If you do not understand how to call a function, learn to code or pay someone.
Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)
Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)
We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)
Something like this.
I'm going to bed.
OnTick(){ string symbol=_Symbol; double lot_size= 0.10; //https://docs.mql4.com/constants/tradingconstants/orderproperties int type = OP_BUY ; //0 = OP_BUY, 1 =OP_SELL, ... if ( Buy_Conditions == true && CheckMoneyForTrade(symbol, lot_size, type) ) { // Buy Market Function ; } }
This is not “recommended code”. That is a function definition. If you do not understand how to call a function, learn to code or pay someone.
Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)
Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)
We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)
I am doing all the above. So your post is not helpful at all.
This is not “recommended code”. That is a function definition. If you do not understand how to call a function, learn to code or pay someone.
Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)
Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)
We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)
ok at least you helped lol i called it. let me see if it works.
I called the function as below and still get the errors as below.
string symbol = "NZDUSD"; // Example symbol double lotSize = 1.0; // Example lot size int tradeType = OP_BUY; // Example trade type, OP_BUY or OP_SELL // Call CheckMoneyForTrade with the specified parameters if(!CheckMoneyForTrade(symbol, lotSize, tradeType)) { // If the function returns false, it means there's not enough margin Print("Initialization failed: Insufficient margin to trade ", symbol, " with ", lotSize, " lots."); return(INIT_FAILED); // Initialization fails } // Other initialization code here... return(INIT_SUCCEEDED); // Initialization successful }
get this error below
test on EURUSD,H1 strategy tester report 13 total trades test on NZDUSD,H1 2021.02.10 10:59:48 Tester: not enough money for sell 0.20 NZDUSD at 0.72075 sl: 0.00000 tp: 0.00000 [2021.02.10 10:59] 2021.02.10 10:59:48 Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 144, FreeMargin: -143.16 2021.02.10 10:59:48 JMachine NZDUSD,H1: OrderSend error 134 2021.02.12 09:59:48 Tester: not enough money for sell 0.20 NZDUSD at 0.71868 sl: 0.00000 tp: 0.00000 [2021.02.12 09:59] 2021.02.12 09:59:48 Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 144, FreeMargin: -142.74 2021.02.12 09:59:48 JMachine NZDUSD,H1: OrderSend error 134 2021.02.24 21:59:56 Tester: not enough money for buy 0.20 NZDUSD at 0.74506 sl: 0.00000 tp: 0.00000 [2021.02.24 21:59] 2021.02.24 21:59:56 Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 149, FreeMargin: -148.01 2021.02.24 21:59:56 JMachine NZDUSD,H1: OrderSend error 134 2021.03.03 14:59:56 Tester: not enough money for sell 0.20 NZDUSD at 0.72583 sl: 0.00000 tp: 0.00000 [2021.03.03 14:59] 2021.03.03 14:59:56 Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 145, FreeMargin: -144.17 2021.03.03 14:59:56 JMachine NZDUSD,H1: OrderSend error 134 2021.03.03 15:59:56 Tester: not enough money for sell 0.20 NZDUSD at 0.72475 sl: 0.00000 tp: 0.00000 [2021.03.03 15:59] 2021.03.03 15:59:56 Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 145, FreeMargin: -143.96 2021.03.03 15:59:56 JMachine NZDUSD,H1: OrderSend error 134 2021.03.04 18:59:56 Tester: not enough money for sell 0.20 NZDUSD at 0.72129 sl: 0.00000 tp: 0.00000 [2021.03.04 18:59] 2021.03.04 18:59:56 Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 144, FreeMargin: -143.26 2021.03.04 18:59:56 JMachine NZDUSD,H1: OrderSend error 134 2021.03.04 19:59:49 Tester: not enough money for sell 0.20 NZDUSD at 0.71751 sl: 0.00000 tp: 0.00000 [2021.03.04 19:59] 2021.03.04 19:59:49 Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 144, FreeMargin: -142.51 2021.03.04 19:59:49 JMachine NZDUSD,H1: OrderSend error 134 there are no trading operations The checks a trading robot mu
You had enough money on initialization.
You need to call it OnTick().
like in my example, I gave earlier.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Trying to sort out this issue, I see the recommended code below: (however i do not know where to add it, already tried but no result yet)