Experts: Mad Trader - page 10

 
patmontes:
The first one is a TP based on setting of Mad Trader set file.

Is anyone going to add SL to this to protect the account?
 
patmontes:
The first one is a TP based on setting of Mad Trader set file.

Is anyone going to add SL to this to protect the account?
 
gator:

Is anyone going to add SL to this to protect the account?

I tried that, but there's not any visible improvement, try it yourself:

//add input variables
extern int sl = 0;
extern int tp = 0;
int putstops() //this goes anywhere under other functions (take care not integrate in any other function, it MUST be alone)
{
   int sls=sl, tpr=tp; 
   int slevel=MarketInfo(Symbol(), MODE_STOPLEVEL);
   if(sls!=0 && sls<slevel) sls=slevel;
   if(tpr!=0 && tpr<slevel) tpr=slevel;
   for(int i = OrdersTotal()-1; i >=0 ; i--)
   {
      ordsl = 0;
      ordtp = 0;
      int mod=-1;
      if (OrderSelect(i, SELECT_BY_POS)>0)
      {
       if(OrderSymbol()==Symbol() && (MAGIC!=0 && OrderMagicNumber()==MAGIC) && OrderType()<=1)
       {
         if(OrderType()==OP_BUY)
         {
          if(OrderStopLoss()==0 && sls!=0) 
            ordsl = NormalizeDouble(OrderOpenPrice() - sls*point,digits); 
          if(OrderTakeProfit()==0 && tpr!=0) 
            ordtp = NormalizeDouble(OrderOpenPrice() + tpr*point,digits); 
 
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=0;//both
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()!=0 || ordtp==0)) mod=1;//sl
          if((OrderStopLoss()!=0 || ordsl==0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=2;//tp
         }
         if(OrderType()==OP_SELL)
         {
          if(OrderStopLoss()==0 && sls!=0) 
            ordsl = NormalizeDouble(OrderOpenPrice() + sls*point,digits); 
          
          if(OrderTakeProfit()==0 && tpr!=0) 
            ordtp = NormalizeDouble(OrderOpenPrice() - tpr*point,digits); 
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=0;//both
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()!=0 || ordtp==0)) mod=1;//sl
          if((OrderStopLoss()!=0 || ordsl==0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=2;//tp
         } 
          switch(mod)
          {
          case -1: break; 
          case 0:  OrderModify(OrderTicket(),OrderOpenPrice(),ordsl,ordtp,0); break;
          case 1:  OrderModify(OrderTicket(),OrderOpenPrice(),ordsl,OrderTakeProfit(),0); break;
          case 2:  OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),ordtp,0); break;
          }
       }
      } 
   } 
return(0);
}
//add this to the end of Start(), e.g.:
void start()
{
...
      putstops(); 
}
//if no TP or SL wanted, set them to 0
 
gator:

Is anyone going to add SL to this to protect the account?

I tried that, but there's not any visible improvement, try it yourself:

//add input variables
extern int sl = 0;
extern int tp = 0;
int putstops() //this goes anywhere under other functions (take care not integrate in any other function, it MUST be alone)
{
   int sls=sl, tpr=tp; 
   int slevel=MarketInfo(Symbol(), MODE_STOPLEVEL);
   if(sls!=0 && sls<slevel) sls=slevel;
   if(tpr!=0 && tpr<slevel) tpr=slevel;
   for(int i = OrdersTotal()-1; i >=0 ; i--)
   {
      ordsl = 0;
      ordtp = 0;
      int mod=-1;
      if (OrderSelect(i, SELECT_BY_POS)>0)
      {
       if(OrderSymbol()==Symbol() && (MAGIC!=0 && OrderMagicNumber()==MAGIC) && OrderType()<=1)
       {
         if(OrderType()==OP_BUY)
         {
          if(OrderStopLoss()==0 && sls!=0) 
            ordsl = NormalizeDouble(OrderOpenPrice() - sls*point,digits); 
          if(OrderTakeProfit()==0 && tpr!=0) 
            ordtp = NormalizeDouble(OrderOpenPrice() + tpr*point,digits); 
 
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=0;//both
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()!=0 || ordtp==0)) mod=1;//sl
          if((OrderStopLoss()!=0 || ordsl==0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=2;//tp
         }
         if(OrderType()==OP_SELL)
         {
          if(OrderStopLoss()==0 && sls!=0) 
            ordsl = NormalizeDouble(OrderOpenPrice() + sls*point,digits); 
          
          if(OrderTakeProfit()==0 && tpr!=0) 
            ordtp = NormalizeDouble(OrderOpenPrice() - tpr*point,digits); 
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=0;//both
          if((OrderStopLoss()==0 && ordsl!=0) && (OrderTakeProfit()!=0 || ordtp==0)) mod=1;//sl
          if((OrderStopLoss()!=0 || ordsl==0) && (OrderTakeProfit()==0 && ordtp!=0)) mod=2;//tp
         } 
          switch(mod)
          {
          case -1: break; 
          case 0:  OrderModify(OrderTicket(),OrderOpenPrice(),ordsl,ordtp,0); break;
          case 1:  OrderModify(OrderTicket(),OrderOpenPrice(),ordsl,OrderTakeProfit(),0); break;
          case 2:  OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),ordtp,0); break;
          }
       }
      } 
   } 
return(0);
}
//add this to the end of Start(), e.g.:
void start()
{
...
      putstops(); 
}
//if no TP or SL wanted, set them to 0
 

Hi Guys, here you are! (the Milestone thread is slowing down).

I am using 22.5 live on 3 pairs EURUSD and GBPUSD since last week Friday (we are now Monday - I added GBPJPY today). Made 9 trades, 9/9 winners. 1.5% account increase.

Only changes made vs original code: Minlot size 0.1 and Milestonegrowth 0.003.

fingers crossed and see what happens next.... ;)

Xavier

 

Hi Guys, here you are! (the Milestone thread is slowing down).

I am using 22.5 live on 3 pairs EURUSD and GBPUSD since last week Friday (we are now Monday - I added GBPJPY today). Made 9 trades, 9/9 winners. 1.5% account increase.

Only changes made vs original code: Minlot size 0.1 and Milestonegrowth 0.003.

fingers crossed and see what happens next.... ;)

Xavier

 
xavier40:

Hi Guys, here you are! (the Milestone thread is slowing down).



But here is still madtrader, the milestone thread is alive :)

Sorry if we have been OT here.

 
xavier40:

Hi Guys, here you are! (the Milestone thread is slowing down).



But here is still madtrader, the milestone thread is alive :)

Sorry if we have been OT here.

 

For those of you who want to add SL/TS to an EA, look at Swiss Army Knife (swissarmyknife) EA. You just add the EA to your charts and it will manage the trades opened by any other EA. I am not using it with MS 22.5 since it stops the profits itself (maybe too soon but that is part of MS success I guess...?). Same for the losses, up till now they all turned into profit.

If anyone tried it, let me know.

 

For those of you who want to add SL/TS to an EA, look at Swiss Army Knife (swissarmyknife) EA. You just add the EA to your charts and it will manage the trades opened by any other EA. I am not using it with MS 22.5 since it stops the profits itself (maybe too soon but that is part of MS success I guess...?). Same for the losses, up till now they all turned into profit.

If anyone tried it, let me know.