Hello.
I need help for something that is still unclear to me.
I am practising on the MACD simple EA, and i.e. i want
to include in the order send, not only the Takeprofit
but also a stop loss.
The instruction in discussion is:
"""""""
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
"""""""
i would like to do something like this:
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-30*Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
But when i put the stop loss i got the error 130.
So i searched for help on the documentation, and
got this trick at https://book.mql4.com/trading/ordersend
in the "Error 130. Invalid Stop Orders" paragraph:
""""""""""""""""
double bid =MarketInfo("EURUSD",MODE_BID); // Request for the value of Bid
double ask =MarketInfo("EURUSD",MODE_ASK); // Request for the value of Ask
double point =MarketInfo("EURUSD",MODE_POINT);//Request for Point
""""""""""""""""
In example with "ask-30*Point"
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,ask-30*Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
It is supposed, in this way, that substituting in the OrderSend() instruction
in the EA, the internal variables "Ask" with the custom created variable"ask", "Bid" with "bid",
and "Point" with "point" (even if -strangely- i've not understant why the trick/example change only Ask and Bid and not
change Point with point..) it is supposely to no more get error 130, but it still come to me.
I've tried also both the example with
Ask->ask; Bid->bid; Point->point
and
Ask->ask; Bid->bid; Point->Point
but both them still give me the error.
Any suggestion, solution etc..?
What the easiest way to put a StopLoss of i.e. 15 pips, when the ordersend() ?
I.e. putting the stoploss when the order send, exactly as the order put the "take profit" order
contextually at the order sending?
I am not talking about a ordermodify, but to put a stoploss and a takeprofit at the moment
order sending -ordersend-
The trick i talked about may be useful, but it has the limit it works with a currency pair
a time, because someone should specify (declare) the variables and instruction in the
EA BEFORE.
I mean that with that trick, i can trade EURUSD, but if i want to switch to USDJPY i should
change the program in example:
double bid =MarketInfo("EURUSD",MODE_BID); // Request for the value of Bid
with
double bid =MarketInfo("USDJPY",MODE_BID); // Request for the value of Bid
and that is lack of dinamicity for an EA.
All suggestions are welcome.
Thanks
- Demo account and SL error 130
- try to start the full automated expert advisor
- Help Needed - MarketInfo() && point=0; => error 130
Try:
Bid-30*Point
blogzr3:
Try:
Bid-30*Point
Great! Simply, it seems run.
Thanks.
But now seems the error 130is transferred to the ordermodify..
Thanks again.
traderkmi:
Great! Simply, it seems run.
Thanks.
But now seems the error 130is transferred to the ordermodify..
Thanks again.
I solved the error 130 to the ordermodify by siply doing
the same thing you suggested me about stoploss in ordersend
to ordermodify, in other words:
Bid-30*Point
even to ordermodify
Thanks.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register