Coding help - page 655

 

mladen

the new iCustom produced the attached. It seems to be stuck on one type of trading and a lot of it. Could you check the inputs, please.


Thank you

Ray 

 

Mladen

OK, I got that working better.

How do I make the enum for the "Averageperiod1 " & the "Pricetouse". I've seen some of your ma method & it is quit involved,

" step_stochastic_ps_-_mtf_amp_alerts_2". I could copy & paste to add its method to the EA but it only has 20 methods and Athens moving average is missing. Can you provide the code snippet for some of the newer enum.

Averageperiod1                       = 1;  //1="Ahrens moving average";
extern bool   Doublesmoothedaverage                = False;
extern bool   Adaptiveaverage                      = False;
extern int    Pricetouse                           = PRICE_CLOSE;


OR can I use the Averageperiod1   = 1;  //1="Ahrens moving average";

                         Averageperiod1    =2                   = 1;  //1="Ahrens moving average"; OKK I think I got that also.


OK I think I just said the answer, I'll test and get back to you.

thanks


Ray

 
traderduke:

Mladen

OK, I got that working better.

How do I make the enum for the "Averageperiod1 " & the "Pricetouse". I've seen some of your ma method & it is quit involved,

" step_stochastic_ps_-_mtf_amp_alerts_2". I could copy & paste to add its method to the EA but it only has 20 methods and Athens moving average is missing. Can you provide the code snippet for some of the newer enum.

Averageperiod1                       = 1;  //1="Ahrens moving average";
extern bool   Doublesmoothedaverage                = False;
extern bool   Adaptiveaverage                      = False;
extern int    Pricetouse                           = PRICE_CLOSE;


OR can I use the Averageperiod1   = 1;  //1="Ahrens moving average";

                         Averageperiod1    =2                   = 1;  //1="Ahrens moving average"; OKK I think I got that also.


OK I think I just said the answer, I'll test and get back to you.

thanks


Ray

Here is the enum for prices :

enum enPrices
{
   pr_close,      // Close
   pr_open,       // Open
   pr_high,       // High
   pr_low,        // Low
   pr_median,     // Median
   pr_typical,    // Typical
   pr_weighted,   // Weighted
   pr_average,    // Average (high+low+open+close)/4
   pr_medianb,    // Average median body (open+close)/2
   pr_tbiased,    // Trend biased price
   pr_haclose,    // Heiken ashi close
   pr_haopen ,    // Heiken ashi open
   pr_hahigh,     // Heiken ashi high
   pr_halow,      // Heiken ashi low
   pr_hamedian,   // Heiken ashi median
   pr_hatypical,  // Heiken ashi typical
   pr_haweighted, // Heiken ashi weighted
   pr_haaverage,  // Heiken ashi average
   pr_hamedianb,  // Heiken ashi median body
   pr_hatbiased   // Heiken ashi trend biased price
};


For the custom period there is no enum - custom time frame minutes are used

 

Hello mladen ,

I want to add a candle trailing stop to my ea , can you help to to check why it cant work .

i have compile with no error and warning .

Is that i have the wrong way to write the code or some things have miss out ?

Thank you .

void TrailingStop()
{
   if(!UseCandleTrailingStop){
      return;
   }
 int BuyStopCandle  = iLowest(NULL,0,MODE_LOW,CandlesBack,0);
 int SellStopCandle = iHighest(NULL,0,MODE_HIGH,CandlesBack,0);
 int err;
 
      //
         
         int    digits     = MarketInfo(OrderSymbol(),MODE_DIGITS);
         double point      = MarketInfo(OrderSymbol(),MODE_POINT);
         double PointRatio = 1;
               if (digits==3 || digits==5) PointRatio = 10;
               
 for(int b = OrdersTotal()-1; b>=0; b--)
 {
  MyResult = OrderSelect(b,SELECT_BY_POS,MODE_TRADES);
    if(OrderMagicNumber() == MagicNumberBuy)
      if(OrderSymbol()!=Symbol())               continue;
        if(OrderType() == OP_BUY)
          RefreshRates();
          
          if(OrderStopLoss()<Low[BuyStopCandle]-PipAwayFromCandle*digits)
             MyResult = OrderModify(OrderTicket(),OrderOpenPrice(),Low[BuyStopCandle]-PipAwayFromCandle*digits,OrderTakeProfit(),0,CLR_NONE);
              err=GetLastError();
               if(err==4 || err==136 || err==137 || err==138 || err==146)
               {
                  RefreshRates();
                  continue;
               }
            break; 
         }                     
 
 for(int s = OrdersTotal()-1; s>=0; s--)
 {
  if(OrderSelect(s,SELECT_BY_POS,MODE_TRADES))
    if(OrderMagicNumber()== MagicNumberSell)
      if(OrderSymbol()!=Symbol())               continue;
        if(OrderType() == OP_SELL)
          RefreshRates();
          
          if(OrderStopLoss()>High[SellStopCandle]+PipAwayFromCandle*digits)
             MyResult = OrderModify(OrderTicket(),OrderOpenPrice(),High[SellStopCandle]+PipAwayFromCandle*digits,OrderTakeProfit(),0,CLR_NONE);         
              err=GetLastError();
               if(err==4 || err==136 || err==137 || err==138 || err==146)
               {
                  RefreshRates();
                  continue;
               }
   }
} 
 // Trailing Stop Closing       
 

hi dearest mladen..

I want to ask a question..Im using woodie cci indicator...ı need to confirm indicator.which ı use indicator for best confirm and best exit.??for m5....please help me...many thanks...

 

mladen

I see the way to test all the enum options. I have included the list of methods & prices  in the bottom of my EA. The EA doesn't appear to be as good as I hoped, at least I can run the 36 methods & 20 prices.


thanks for your help


mnt

here is the completed EA, I haven't tested the different TSs yet. Let me know if you find anything good.

 
stevenpun:

Hello mladen ,

I want to add a candle trailing stop to my ea , can you help to to check why it cant work .

i have compile with no error and warning .

Is that i have the wrong way to write the code or some things have miss out ?

Thank you .

stevenpun

as far as is see you have to replace this :

PipAwayFromCandle*digits

with this :

PipAwayFromCandle*PointRatio*_point
But it depends on the declaration of the PipAwayFromCandle variable (which is not seen in the code you posted)
 
traderduke:

mladen

I see the way to test all the enum options. I have included the list of methods & prices  in the bottom of my EA. The EA doesn't appear to be as good as I hoped, at least I can run the 36 methods & 20 prices.


thanks for your help


mnt

here is the completed EA, I haven't tested the different TSs yet. Let me know if you find anything good.

I guess you are still in updating process as i see you asking regarding prices and methods,so i will be pleased when you finished all these,upload it,any way thanks a lot for the current ver.

regards

 

hello,

I have a small request - could someone add please a double breakeven option to this EA? currently it moves my SL to BE+2 after 5 pips profit, but I would like to move it once again to BE+5 after 9 pips profit :)

 

thanks in advance :) 

Files:
 
freakout:

hello,

I have a small request - could someone add please a double breakeven option to this EA? currently it moves my SL to BE+2 after 5 pips profit, but I would like to move it once again to BE+5 after 9 pips profit :)

 

thanks in advance :) 

It has a trailing stop. Did you try using trailing stop instead?