--------------------------------------------------------+ //| - TopicsExpress



          

--------------------------------------------------------+ //| earlyTopProrate_V1.mq4 20.08.2010 - 08:54 //|(earlyOpenTrend.my4) //| //| //| dailyOpen = Basiswert, , DailyHigh, -Low = Selektion //+------------------------------------------------------------------+ #property copyright "hansH" #property link "" extern int StartHour = 0; extern int EndHour = 24; extern int ClosingHour = 24; extern int ZD = 0; // ---- double Lots = 0.5; extern int maxPos = 1; int TP1 = 25; int TP2 = 50; int TP3 = 75; int setTP = 35; // TP => OpenPrice int setSL0 = 100; // SL=> +/-50 int setSL1 = 35; // 40 int setSL2 = 60; // 90 int modiSL = 25; // setSL2-35=25 int Ratio1 = 30; // nicht ändern! int Ratio2 = 70; // nicht ändern! int Ratio3 = 100; // nicht ändern! int Phase = 0; int Magic =170810; bool CommentMode = true; bool SignalBuy =false; bool SignalSell =false; // MoneyManagement extern int MMTyp = 0; int FactorMM2 = 3; int RiskMM2 = 50; // ---- double o1, h1, l1; double MAtrend, MAtrend1; double modLots, varLots, opLongLots, opShortLots; string ProfitPoints; int i; //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ int start() { modiSL = setSL2-35; // ---- Anzahl offene Positionen/Typ int cnt, cntOpPos, cntOpLong=0, cntOpShort=0; double Prof; for(cnt=0; cnt=TP3*10*Point && Phase==2 && TP3>0) { OrderClose(OrderTicket(),modLots(OrderLots()*Ratio3/100),Bid,0); Phase=3; return(0); } } // if (OrderType()==OP_BUY) // ---- if (OrderType()==OP_SELL) { opShortLots=OrderLots(); /* //---- SL- u. TP-Modify if (OrderStopLoss()==0) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+modiSL*10*Point,OrderTakeProfit(),0); return(0); } */ //---- setTP **** 35 **** / TP auf OrderOpenPrice() setzen if (setTP>0 && OrderOpenPrice()-Ask0 && OrderOpenPrice()-Ask0 && OrderOpenPrice()-Ask>=setSL1*10*Point && OrderStopLoss()>OrderOpenPrice()) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0); return(0); } //---- setSL2 / SELL-SL senken auf OrderOpenPrice()-modiSL if (setSL2>0 && OrderOpenPrice()-Ask>=setSL2*10*Point && OrderStopLoss()>OrderOpenPrice()-modiSL*10*Point) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-modiSL*10*Point,OrderTakeProfit(),0); return(0); } //---- TP1 if(OrderOpenPrice()-Ask>=TP1*10*Point && Phase==0 && TP1>0) { OrderClose(OrderTicket(),modLots(OrderLots()*Ratio1/100),Ask,0); Phase=1; return(0); } //---- TP2 if(OrderOpenPrice()-Ask>=TP2*10*Point && Phase==1 && TP2>0) { OrderClose(OrderTicket(),modLots(OrderLots()*Ratio2/100),Ask,0); Phase=2; return(0); } //---- TP3 **** 75 **** if(OrderOpenPrice()-Ask>=TP3*10*Point && Phase==2 && TP3>0) { OrderClose(OrderTicket(),modLots(OrderLots()*Ratio3/100),Ask,0); Phase=3; return(0); } } // if (OrderType()==OP_SELL) // ---- //if(Phase==0) { if (opLongLots==Lots || opShortLots==Lots || (opLongLots==0 && opShortLots==0) ) { Phase=0; ProfitPoints=(TP1+", "+TP2+", "+TP3); } else if((opLongLots >Lots/2 && opShortLots==0) || (opShortLots>Lots/2 && opLongLots ==0)) { Phase=1; ProfitPoints=(TP2+", "+TP3); } else if((opLongLots =ClosingHour) OrderClose(OrderTicket(),opLongLots,Bid,0); // nicht: OrderLots() 0.1 if (OrderType()==OP_SELL && Hour()>=ClosingHour) OrderClose(OrderTicket(),opShortLots,Ask,0); // nicht: OrderLots() 0.1 } // if(ClosingHour!=0) // ---- } // if (OrderSymbol() } // for (int cnt } // if (cntOpPos>0) //---- return(0); } // int start() // ----------------------------------- // ---- modLots (MoneyManagement) ---- // ----------------------------------- double modLots(double varLots) { double lotStep = MarketInfo(Symbol(), MODE_LOTSTEP); double tempDouble = varLots + lotStep/2; tempDouble /= lotStep; int tempInt = tempDouble; return (tempInt*lotStep)
Posted on: Sat, 03 Aug 2013 01:20:54 +0000

Trending Topics




© 2015