Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
PLease help on the above buy condition. My EA only opens sell
Thank you
I don't find about sell order.
Is it typo?
I think
First, typo.
Second, true is a constant. "if (true)" is always true condition.
Hey guys. I have been struggling with the following code for days.
You have TP set to 0 points - that is causing trades to close immediately. If you want other hours just change 0 to something you want.
You have TP set to 0 points - that is causing trades to close immediately. If you want other hours just change 0 to something you want.
TP set to zero means that there is no TP.
Same for SL
You have TP set to 0 points - that is causing trades to close immediately. If you want other hours just change 0 to something you want.
I have looked at the code now and I guess that you may have meant that the input TakeProfit is set at zero
The code should be modified to allow for inputs set at zero.
if(Close[1]<Open[1]) { double tp=0; if(TakeProfit>0) tp=Bid+TakeProfit*Point; double sl=0; if(StopLoss>0) sl=Bid-StopLoss*Point; ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,sl,tp,"Set by Open Close System"); if(ticket<0) Alert("Error Sending Buy Order!"); } else { double tp=0; if(TakeProfit>0) tp=Ask-TakeProfit*Point; double sl=0; if(StopLoss>0) sl=Ask+StopLoss*Point; ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,sl,tp,"Set by Open Close System"); if(ticket<0) Alert("Error Sending Sell Order!"); }