This is a Good Auto EA ( MT4 ) , if you are a programmer please help ( August 2011 Year )

 

This is a Good Auto EA ( MT4 ), if you are a programmer please help ( August 2011 Year )

To Use just change the Trade Time will do .

This is a Good Auto EA (MT 4 ), But need to have Some Fine tune,

if you are a programmer please help . Trailing stop not working . and journal report :

2011.08.05 17:06:46 2011.08.04 23:59 David v001 EURUSD,H1: OrderModify error 4108
2011.08.05 17:06:46 2011.08.04 23:59 David v001 EURUSD,H1: unknown ticket 107 for OrderModify function
2011.08.05 17:06:46 2011.08.04 23:59 David v001 EURUSD,H1: OrderModify error 4108
2011.08.05 17:06:46 2011.08.04 23:59 David v001 EURUSD,H1: unknown ticket 107 for OrderModify function

Strategy Tester Report
David v001
AvaFinancial-Real (Build 402)

Symbol EURUSD (Euro vs US Dollar)
Period 1 Hour (H1) 2011.01.02 22:00 - 2011.08.04 23:00 (2011.01.01 - 2011.08.05)
Model Every tick (the most precise method based on all available least timeframes)
Parameters TakeProfit_L=53; StopLoss_L=73; TakeProfit_S=22; StopLoss_S=39; TrailingStop=30; delta_L=6; delta_S=21; Slippage=3; TradeTime=12; FridayCloseHour=25; magic=2011333; t1=14; t2=7; lot=0.01; Orders=1; MaxOpenTime=504; BigLotSize=1; AutoLot=true; comment=">>> Auto Buy / Sell";
Bars in test 4701 Ticks modelled 1546852 Modelling quality 77.38%
Mismatched charts errors 0
Initial deposit 1000.00
Total net profit 23442.82 Gross profit 97187.81 Gross loss -73744.99
Profit factor 1.32 Expected payoff 219.09
Absolute drawdown 208.00 Maximal drawdown 21441.67 (51.00%) Relative drawdown 66.87% (3679.95)
Total trades 107 Short positions (won %) 40 (65.00%) Long positions (won %) 67 (73.13%)
Profit trades (% of total) 75 (70.09%) Loss trades (% of total) 32 (29.91%)
Largest profit trade 6360.00 loss trade -11481.67
Average profit trade 1295.84 loss trade -2304.53
Maximum consecutive wins (profit in money) 9 (16944.00) consecutive losses (loss in money) 3 (-3247.95)
Maximal consecutive profit (count of wins) 23357.85 (7) consecutive loss (count of losses) -20241.67 (2)
Average consecutive wins 3 consecutive losses 1





Files:
davidbv001.mq4  12 kb
 

When you do this . . .

 //Manage open orders
         //move Real.TrailingStop if profit>TS
            
            if(OrderType()==OP_SELL) 
            {
               if(OrderOpenPrice()-Ask>Real.TrailingStop*Point && OrderStopLoss()>Ask+Real.TrailingStop*Point)
              {
                  OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Real.TrailingStop*Point,0,0, Red);
              }           
           }

. . . what order have you selected ?

maybe it explains this ?

2011.08.05 17:06:46 2011.08.04 23:59 David v001 EURUSD,H1: OrderModify error 4108

4108 -> ERR_INVALID_TICKET 4108 Invalid ticket.

 
RaptorUK:

When you do this . . .

. . . what order have you selected ?

maybe it explains this ?

2011.08.05 17:06:46 2011.08.04 23:59 David v001 EURUSD,H1: OrderModify error 4108

4108 -> ERR_INVALID_TICKET 4108 Invalid ticket.


EUR/USD 1 HOUR
 

When you use OrderType(), OrderOpenPrice(), etc. you first need to use OrderSelect()

https://docs.mql4.com/trading/OrderType https://docs.mql4.com/trading/OrderOpenPrice


int OrderTicket()

"Returns ticket number for the currently selected order.

Note: The order must be previously selected by the OrderSelect() function."

 
Please change for me. I don't know how to do
 
RaptorUK:

When you use OrderType(), OrderOpenPrice(), etc. you first need to use OrderSelect()

https://docs.mql4.com/trading/OrderType https://docs.mql4.com/trading/OrderOpenPrice


int OrderTicket()

"Returns ticket number for the currently selected order.

Note: The order must be previously selected by the OrderSelect() function."


Can give me some example of the code ??

 
david2222:


Can give me some example of the code ??

Have a read of stuff here: http://crum.be/trailsl

and here: https://forum.mql4.com/23384

 
david2222:
if you are a programmer please help . Trailing stop not working
  1. int start(){
      HandleDigits();
    
    Only needs to be done once in init()
  2.     if(TimeHour(TimeCurrent())>=FridayCloseHour)
         {
           CloseAllBuyOrders(magic);
           CloseAllSellOrders(magic);
         
         }
    
      if((TimeHour(TimeCurrent())>TradeTime)) cantrade=true;  
    
    First you close all orders at the end of the week and then continue and open more. Missing a return?
  3.   if (DayOfWeek()==5)
        if(TimeHour(TimeCurrent())>=FridayCloseHour)
    
       for (i=iTotalOrders; i>=0; i--) // Rosh line  
       { 
          if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
          { 
             if (OrderMagicNumber()==MN)
               if (OrderSymbol()== Symbol())
                 { 
    
    Each of these should be one statement not four. You mean 'select my orders' one thought
       for (i=iTotalOrders; i>=0; i--) if(
          OrderSelect(i, SELECT_BY_POS, MODE_TRADES)
       && OrderMagicNumber() == MN
       && OrderSymbol()      == Symbol()
       ){ 
    

  4. On the OrderClose(... Bid/Ask) If you are closing multiple orders, you must RefreshRates() between server calls. Also Bid/Ask is unnecessary you can use OrderClosePrice() for either direction.
  5.   if(ticket>0)
      {
        if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
          {
            return(0);
          }
    
    Why select it if you're not going to do anything with it.
  6.     //Manage open orders
             //move Real.TrailingStop if profit>TS
                
                if(OrderType()==OP_SELL) 
                {
                   if(OrderOpenPrice()-Ask>Real.TrailingStop*Point && OrderStopLoss()>Ask+Real.TrailingStop*Point)
                  {
                      OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Real.TrailingStop*Point,0,0, Red);
                  }           
               }
    
    You haven't selected anything, so OrderTicket, etc is bogus. Only valid just after opening the order due to #3.
  7. No trailing stops for BUYs?

  8.    if(MaxOpenTime>0)
       {
          for(cnt=0;cnt<total;cnt++)
    
    You MUST count down when closing/modify/deleting in the presence of multiple orders (multiple charts) You already have to closing functions, use them.

  9. //                       if (OrderType()==OP_BUY)
    //                           closeprice=Bid;
    //                       else  
    //                           closeprice=Ask;          
                                 closeprice = OrderClosePrice();

 
WHRoeder:
  1. Only needs to be done once in init()
  2. First you close all orders at the end of the week and then continue and open more. Missing a return?
  3. Each of these should be one statement not four. You mean 'select my orders' one thought

  4. On the OrderClose(... Bid/Ask) If you are closing multiple orders, you must RefreshRates() between server calls. Also Bid/Ask is unnecessary you can use OrderClosePrice() for either direction.
  5. Why select it if you're not going to do anything with it.
  6. You haven't selected anything, so OrderTicket, etc is bogus. Only valid just after opening the order due to #3.
  7. No trailing stops for BUYs?

  8. You MUST count down when closing/modify/deleting in the presence of multiple orders (multiple charts) You already have to closing functions, use them.



ok . Thanks

 

Forex EA (Expert Adviser) Forex Robot Programmer Developer
Hi,By Profession Im Software Engineer. But from last 7 years Im in Forex Trading. I 've developed many more Forex Robots EA Expert Advisers, and distributed to client as per given criteria. There are so many satisfied clients.
If any one wants to automate their own strategy, or wants their own Forex Robot / EA Expert Adviser: contact immediately:forex.eamaster@gmail.com