Please use the SRC button when posting code. I've fixed it for you this time
sorry
and
thank you
sorry
and
thank you
Are you seeing any errors in your journal?
no
and realy would like to
what's wrong?
pls help
no
and realy would like to
what's wrong?
pls help
Your problem is the way you've coded the conditional logic for the buy sell. Currently, if the buy condition is met, it then drops down to check the sell condition. As this is false, it moves to the "else" of the sell condition which resets the order var to zero, hence no trade is opened. Try something like this instead:
if(c1>SMA200 && cci1>-100 && cci2<=-100)
{
order=1;
ord="buy";
}
else if(c1<SMA200 && cci1<100 && cci2>=100)
{
order=-1;
ord="sell";
}
else
{
order=0;
ord="";
}
You could also streamline your OrderSend() code so you don't need to check for buy/sell again but it should work OK as it is, just not as efficient.
Cheers
Stu
thank you
i will try
thank you
i will try
void TechnicalAnalysis3x18() { if ((iStochastic(NULL, PERIOD_M15,5,3,3,MODE_SMA,1,MODE_MAIN,current+1)<20 && (iStochastic(NULL, PERIOD_M15,5,3,3,MODE_SMA,1,MODE_MAIN,current+1)<20 > 20) && (iStochastic(NULL, PERIOD_M15,5,3,3,MODE_SMA,1,MODE_MAIN,current+1) > (iStochastic(NULL, PERIOD_M15,5,3,3,MODE_SMA,1,MODE_SIGNAL,current+1))) && (iStochastic(NULL, PERIOD_M15,5,3,3,MODE_SMA,1,MODE_SIGNAL,current)<50))) { IfOrderDoesNotExist21(); } } void IfOrderDoesNotExist21() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OrderType21 && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { BuyOrder12(); } } void BuyOrder12() { double SL = Ask - BuyStoploss12*PipValue*Point; if (BuyStoploss12 == 0) SL = 0; double TP = Ask + BuyTakeprofit12*PipValue*Point; if (BuyTakeprofit12 == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_BUY, BuyLots12, Ask, BuySlippage12, 0, 0, BuyExpertName12, 1, 0, Blue); else ticket = OrderSend(Symbol(), OP_BUY, BuyLots12, Ask, BuySlippage12, SL, TP, BuyExpertName12, 1, 0, Blue); if (ticket > -1) { if (true) { bool sel = OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } LimitOpenOrders11(); } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } }
PLease help on the above buy condition. My EA only opens sell
Thank you
Please use the code button when inserting code. I have edited it for you this time.
Also please avoid using huge gaps between lines, it can make the code difficult to read.

- 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 tried to test my ea by the strategy tester , but it open only sell order.
what 's wrong?