Originally Posted by pgiani
I found out why the expert does not go short, is an error on the code on the check for open condicion - SELL is the Stop loss calcuation, need to change the minus sign for a plus sign , it has causing the error 130 , the same error is present on the traling stop routine for the 4step.
//---- Sell conditions
if(Momentum<100 && AC2!=0 && AO2<0 && AO22<=0 && St<Stoch_Entry_Sell && St<Sts && Open[0]<MA )
{ Comment("sell");
{
if (AutoSL==true )
{if (SL_use_Moment_2MFI ==true)
SL=Bid+(iMomentum(NULL,0,Momentum_Period,PRICE_MOD E,0)+(iMFI(NULL,0,Momentum_Period,0)*2))*Point;
if (SL_use_2ATR==true)
130(( SL=Bid+(iATR(NULL,0,55,0)*2);
}
else
SL=Bid+StopLoss*Point;
/}
res=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,S L,Bid-TakeProfit1*Point,"Lot 1 v2.1 M Series",MAGICMA,0,Red);
res=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,S L,Bid-TakeProfit2*Point,"Lot 2 v2.1 M Series",MAGICMA,0,Red);
res=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,S L,Bid-TakeProfit3*Point,"Lot 3 v2.1 M Series",MAGICMA,0,Red);
return;
}
//----
}
But the AI does not take many short positions any way, when i get the code to be profitable on short possition I will post it here.
|