|
How about Pictures....
Here it is with ManageOrders(); disabled....
Question is why is this code opening multiple orders at the same time ?
void CheckForOpen () {
if (UseStoch){
double STOCHOSCMAIN = iCustom(NULL,STOCHTIME,"Zerolagstochs",0,SIGNALCAN DLE);
double STOCHOSCSIGNAL = iCustom(NULL,STOCHTIME,"Zerolagstochs",1,SIGNALCAN DLE);
double pSTOCHOSCMAIN = iCustom(NULL,STOCHTIME,"Zerolagstochs",0,SIGNALCAN DLE+1);
double pSTOCHOSCSIGNAL = iCustom(NULL,STOCHTIME,"Zerolagstochs",1,SIGNALCAN DLE+1);
if (STOCHOSCMAIN >= STOCHOSCSIGNAL && pSTOCHOSCMAIN > pSTOCHOSCSIGNAL && STOCHOSCSIGNAL < 50){
EnterOpenBuy();
}
if (STOCHOSCMAIN <= STOCHOSCSIGNAL && pSTOCHOSCMAIN < pSTOCHOSCSIGNAL && STOCHOSCSIGNAL > 50){
EnterOpenSell();
}
}
if (UseCCI){
double CCI = iCCI(NULL,0,CciPer,PRICE_MEDIAN,SIGNALCANDLE);
double CCIPrevious = iCCI(NULL,0,CciPer,PRICE_MEDIAN,SIGNALCANDLE+1);
if (CCI > Cci_Level1 && CCIPrevious <= Cci_Level1){
EnterOpenBuy();
}
if (CCI > Cci_Level2 && CCIPrevious <= Cci_Level2){
EnterOpenBuy();
}
if (CCI > Cci_Level3 && CCIPrevious <= Cci_Level3){
EnterOpenBuy();
}
if (CCI < Cci_Level1 && CCIPrevious >= (-Cci_Level1)){
EnterOpenSell();
}
if (CCI < Cci_Level2 && CCIPrevious >= (-Cci_Level2)){
EnterOpenSell();
}
if (CCI < Cci_Level3 && CCIPrevious >= (-Cci_Level3)){
EnterOpenSell();
}
}
}
And here is the EnterOpen() functions...
void EnterOpenBuy(){
GetTrend();
double LongLots = ((AccountFreeMargin()* AccountLeverage()* UpTrend / MarketInfo(Symbol(), MODE_LOTSIZE)) * (RiskPercent/100.0))/MaxOrders;
if (LongLots < 0.1) {LongLots = 0.1;}
OrderSend(Symbol(),OP_BUY,LongLots , Ask, OrderSlippage,Bid-StopLoss*Point,Ask+TakeProfit*Point, "Open Buy", Magic, 0, Green);
Print ("OPEN BUY : ", OrderLots());
return (0);
}
void EnterOpenSell(){
GetTrend();
double ShortLots = ((AccountFreeMargin()* AccountLeverage()* DownTrend / MarketInfo(Symbol(), MODE_LOTSIZE)) * (RiskPercent/100.0))/MaxOrders;
if (ShortLots < 0.1) {ShortLots = 0.1;}
OrderSend(Symbol(), OP_SELL, ShortLots, Bid, OrderSlippage,Ask+StopLoss*Point,Bid-TakeProfit * Point, "Open Sell", Magic, 0, Red);
Print ("OPEN SELL : ", OrderLots());
return (0);
}
|