I have been getting this error and I cant seem to figure out the cause.
I have been trying for the last 3 days to figure it out. I assume its because of my send order operation so I have adjusted everything I can think of. Nothing seems to stop it from appearing in my journal during backtesting.
one thing it says in the documentation is it may simply be that there is information it cannot translate. I was hoping someone could help me pinpoint the cause. I have looked through the documentation for everything related to send orders and errors. I have scoured through looking for explanations on ask and bid and and i have tried using MarketInfo() to gather data to use in order to calculate my ask and bid. I have created take profit and stop loss for both buy and sell orders. Not sure what else to try. I have done my best to try and comment my code as much as possible.
The code is supposed to identify an engulfing pattern and either buy or sell based on the trend. If there is a bull trend then buy on bull engulfing patterns if there is a bear trend then sell when there is a bear engulfing pattern.
So far not only do I get buying and selling error 130 it seems like its not obeying my if checks. it seems to buy and sell even if there is no engulfing pattern.
I appreciate you time folks.
I really am trying hard to find it on my own but I'm stumped.
the reason u get this error is because ur OrderSend are not been setup properly . There is 2 reason that causes this error whereby 1)MODE_MINLOT 2)topLossBuy,takeProfitBuy , as shown below ;
OrderSend(Symbol(),OP_BUY,MODE_MINLOT,Ask,30,stopLossBuy,takeProfitBuy,"My order ",16384,0,clrRed);
to overcome this problem u need to setup ur ordersend something like this ;
double lot=0.01; ticket = OrderSend(Symbol(),OP_BUY,lot,Ask,30,Ask-(stopLoss*Point),Ask+(takeProfit*Point),"My order ",16384,0,clrRed);
regards
Cosmas
//Variables to store the value of the entire candle double totalCandleValueOne = High[1]-Low[1]; double totalCandleValueTwo = High[2]-Low[2]; double totalCandleValueThree = High[3]-Low[3]; ⋮ //Variables for buy and sell take profit double takeProfit = 500; double takeProfitBuy = Ask+(takeProfit*pips); double takeProfitSell = Bid-(takeProfit*pips); //variables for buy and sell stop loss double stopLoss = 150; double stopLossSell = Bid+(stopLoss*pips); double stopLossBuy = Ask-(stopLoss*pips);Global and static variables work exactly the same way in MT4/MT5/C/C++.
- They are initialized once on program load.
- They don't update unless you assign to them.
- In C/C++ you can only initialize them with constants, and they default to zero. In MTx you should only initialize them with constants.
There is no default in MT5 (or MT4
with strict which you should always use.)
MT4/MT5 actually compiles with non-constants, but the order that they are initialized is unspecified and don't try to use any price or server related functions in OnInit (or on load,) as there may be no connection/chart yet:
- Terminal starts.
- Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
- OnInit is called.
- For indicators OnCalculate is called with any existing history.
- Human may have to enter password, connection to server begins.
- New history is received, OnCalculate called again.
- New tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.
- Unlike indicators, EAs are not reloaded on chart change so you must reinitialize them, if necessary.
external static variable - MQL4 programming forum
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have been getting this error and I cant seem to figure out the cause.
I have been trying for the last 3 days to figure it out. I assume its because of my send order operation so I have adjusted everything I can think of. Nothing seems to stop it from appearing in my journal during backtesting.
one thing it says in the documentation is it may simply be that there is information it cannot translate. I was hoping someone could help me pinpoint the cause. I have looked through the documentation for everything related to send orders and errors. I have scoured through looking for explanations on ask and bid and and i have tried using MarketInfo() to gather data to use in order to calculate my ask and bid. I have created take profit and stop loss for both buy and sell orders. Not sure what else to try. I have done my best to try and comment my code as much as possible.
The code is supposed to identify an engulfing pattern and either buy or sell based on the trend. If there is a bull trend then buy on bull engulfing patterns if there is a bear trend then sell when there is a bear engulfing pattern.
So far not only do I get buying and selling error 130 it seems like its not obeying my if checks. it seems to buy and sell even if there is no engulfing pattern.
I appreciate you time folks.
I really am trying hard to find it on my own but I'm stumped.