Thread: How to code?
View Single Post
  #33 (permalink)  
Old 03-03-2006, 10:42 PM
Mohammed's Avatar
Mohammed Mohammed is offline
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Arrow

Quote:
Originally Posted by stu
I have a portion of code for a Moving Stop, but have no programming experience to make an EA out of it. Will somebody with EA creation ability kindly produce an EA with the code below?!?

Code:
total=OrdersTotal(); 
   if(total>0){ 
      for(cnt=0;cnt<total;cnt++){ 
         OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 
         if(OrderType()==OP_BUY && OrderSymbol()==Symbol()){ 
            if(Bid-OrderOpenPrice()>=Point*15 &&  Bid-OrderOpenPrice()<Point*20 && OrderStopLoss()< OrderOpenPrice()-5*Point){ 
               OrderModify(OrderTicket(),OrderOpenPrice()-Point*5,OrderTakeProfit(),Blue); 
            } 
            if(Bid-OrderOpenPrice()>=Point*20 && OrderStopLoss()< OrderOpenPrice()){ 
               OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(),Blue); 
            } 
         } 
      } 
   }
The EA will move the Stop to -5 after moving 15 pips favorably, and move Stop to BreakEven after moving 20 pips favorably.
stu,

Do you want to apply this technique to any EA? Or you have entry points for this EA?

I think your technique is very good one!
Reply With Quote