كود:
double StopLoss;
double TakeProfit;
extern double Lot=0.1;
int magic=14253;
int slippage=3;
int P=1;
int start(){
if (Digits==3 || Digits==5)P=10;
if(iMA(0,0,7,0,0,0,1)>iMA(0,0,15,0,0,0,1) && iMA(0,0,7,0,0,0,2)<iMA(0,0,15,0,0,0,2)&& iRSI(0,0,14,0,1)>50
&& iMomentum(0,0,15,0,1)>100){
StopLoss=iCustom(0,60,"Support and Resistance (Barry)",1,0)-0.0015;
if(iMA(0,0,90,0,0,0,1)>iMA(0,0,7,0,0,0,1) && iMA(0,0,90,0,0,0,1)>iMA(0,0,15,0,0,0,1))TakeProfit= iMA(0,0,90,0,0,0,1);
else TakeProfit=iCustom(0,60,"Support and Resistance (Barry)",0,0);
OrderSend(Symbol(), OP_BUY,Lot, Ask, slippage*P, StopLoss, TakeProfit, "", magic, 0, Green);
}
if(iMA(0,0,7,0,0,0,1)<iMA(0,0,50,0,0,0,1) && iMA(0,0,7,0,0,0,2)>iMA(0,0,50,0,0,0,2)&& iRSI(0,0,14,0,1)<50
&& iMomentum(0,0,15,0,1)<100){
StopLoss=iCustom(0,60,"Support and Resistance (Barry)",0,0)+0.0015;
if(iMA(0,0,90,0,0,0,1)<iMA(0,0,7,0,0,0,1) && iMA(0,0,90,0,0,0,1)<iMA(0,0,15,0,0,0,1))TakeProfit= iMA(0,0,90,0,0,0,1);
else TakeProfit=iCustom(0,60,"Support and Resistance (Barry)",1,0);
OrderSend(Symbol(), OP_SELL,Lot, Ask, slippage*P, StopLoss, TakeProfit, "", magic, 0, Green);
}
return (0);
}