Coding help - page 759

 
Dearest MLADEN

As for warnings when compiled "return value of ''order send/select,modify,close'' were corrected by adding (bool dummyResult) previously but now i see you using simply (bool dummy),is it ok for all and every situation or the new (bool dummy) for some specific indicators and situations ?

regards
 
mntiwana:
Dearest MLADEN

As for warnings when compiled "return value of ''order send/select,modify,close'' were corrected by adding (bool dummyResult) previously but now i see you using simply (bool dummy),is it ok for all and every situation or the new (bool dummy) for some specific indicators and situations ?

regards
Usually those warnings are benign.

What is used to really check if order operation(s) are OK is GetLastError() (since it gives much more details than the simple boolean return that the default return from order operations returns) - so, yes it is OK, and then, if more detail for a possible error is needed then, by all means, GetLastError() should be used
 
wojtekpaul:

(what we will do after 31st January?) :(

WojtekPaul,

How do you mean that? 

 
chrisstoff:

WojtekPaul,

How do you mean that? 

He meant this : https://www.forex-tsd.com/forum/announcements-forex-press/1811320-forex-tsd-is-going-to-be-terminated

But check this post too : https://www.forex-tsd.com/forum/announcements-forex-press/1811320-forex-tsd-is-going-to-be-terminated/page4#comment_1849089
 
mladen:
Usually those warnings are benign.

What is used to really check if order operation(s) are OK is GetLastError() (since it gives much more details than the simple boolean return that the default return from order operations returns) - so, yes it is OK, and then, if more detail for a possible error is needed then, by all means, GetLastError() should be used
Dearest MLADEN

Thanks for help guidance.

regards
 

Mladen,

Thank you for the information. This is / was my one of the most favourable forums, so it is a bad news for me, either. Nevertheless, there are other places with ready made forum and chat features over the net. (I put one example into the "Forex-TSD is going to be terminated..." thread.) 

 

Hello everyone,


I need a coder to put an arrow with alert for this extrategia. Manually this strategy is giving 100% victory.


Below is the link to the strategy.

 

 http://www.binaryoptionsedge.com/topic/1879-high-power-option-2015/page-2#entry108014

Post #29

 

 Obrigado. 

 

Dear Mladen, is it possible that the two following functions:

iMA(NULL,0,MAPeriod,0,MODE_EMA,PRICE_HIGH,i);

and

iCustomMa(ma_ema,getPrice(pr_high,Open,Close,High,Low,i),MAPeriod,i,0);
(or iCustomMa(ma_ema,iMA(NULL,0,1,0,MODE_SMA,PRICE_HIGH,i),MAPeriod,i,0); )
where ma_ema is defined below:
#define _maWorkBufferx1 1
#define _maWorkBufferx2 2
#define _maWorkBufferx3 3
#define _maWorkBufferx5 5
double iCustomMa(int mode, double price, double length, int i, int instanceNo=0)
{
   if (length<=1) return(price);
   int r = Bars-i-1;
   switch (mode)
   {
      // ...
      case ma_ema   : return(iEma(price,length,r,instanceNo));
      // ...
      default : return(0);
   }
}

double workEma[][_maWorkBufferx1];
double iEma(double price, double period, int r, int instanceNo=0)
{
   if (ArrayRange(workEma,0)!= Bars) ArrayResize(workEma,Bars);
   //
   double alpha = 2.0 / (1.0+period);
          workEma[r][instanceNo] = workEma[r-1][instanceNo]+alpha*(price-workEma[r-1][instanceNo]);
   return(workEma[r][instanceNo]);
}
return different values (for the same MAPeriod and i)?  Would it mean
that iEma works sligthly different from the built-in EMA?
 
wojtekpaul:

Dear Mladen, is it possible that the two following functions:

iMA(NULL,0,MAPeriod,0,MODE_EMA,PRICE_HIGH,i);

and

iCustomMa(ma_ema,getPrice(pr_high,Open,Close,High,Low,i),MAPeriod,i,0);
(or iCustomMa(ma_ema,iMA(NULL,0,1,0,MODE_SMA,PRICE_HIGH,i),MAPeriod,i,0); )
where
#define _maWorkBufferx1 1
#define _maWorkBufferx2 2
#define _maWorkBufferx3 3
#define _maWorkBufferx5 5
double iCustomMa(int mode, double price, double length, int i, int instanceNo=0)
{
   if (length<=1) return(price);
   int r = Bars-i-1;
   switch (mode)
   {
      // ...
      case ma_ema   : return(iEma(price,length,r,instanceNo));
      // ...
      default : return(0);
   }
}

double workEma[][_maWorkBufferx1];
double iEma(double price, double period, int r, int instanceNo=0)
{
   if (ArrayRange(workEma,0)!= Bars) ArrayResize(workEma,Bars);
   //
   double alpha = 2.0 / (1.0+period);
          workEma[r][instanceNo] = workEma[r-1][instanceNo]+alpha*(price-workEma[r-1][instanceNo]);
   return(workEma[r][instanceNo]);
}
return different values (for the same MAPeriod and i)?  Would it mean
that iEma works sligthly different from the built-in EMA?
EMA depends on previous values. If you calculated the values on the whole series, they should return very similar values. If not (if you tried to calculate just one value), they will not be the same since the iMA() will, behind the curtains, calculate the whole series, while the iCustomMa() will calculate only the values you have requested.

Loop the iCustomMa() on the whole series, and the results should be the same


PS: that iEma() is obsolete. The new version goes like this (it is not going to change the values, but it is "strict mode proof")
double workEma[][_maWorkBufferx1];
double iEma(double price, double period, int r, int instanceNo=0)
{
   if (ArrayRange(workEma,0)!= Bars) ArrayResize(workEma,Bars);
   //
  
   workEma[r][instanceNo] = price;
   if (r>0 && period>1)
          workEma[r][instanceNo] = workEma[r-1][instanceNo]+(2.0/(1.0+period))*(price-workEma[r-1][instanceNo]);
   return(workEma[r][instanceNo]);
}
 

Thanks a lot for your fast reply!   Could you please tell me where can

I find the current code of the moving averages:

enum enMaTypes
{
   ma_sma,     // simple moving average - SMA
   ma_ema,     // exponential moving average - EMA
   ma_dsema,   // double smoothed exponential moving average - DSEMA
   ma_dema,    // double exponential moving average - DEMA
   ma_tema,    // tripple exponential moving average - TEMA
   ma_smma,    // smoothed moving average - SMMA
   ma_lwma,    // linear weighted moving average - LWMA
   ma_pwma,    // parabolic weighted moving average - PWMA
   ma_alxma,   // Alexander moving average - ALXMA
   ma_vwma,    // volume weighted moving average - VWMA
   ma_hull,    // Hull moving average
   ma_tma,     // triangular moving average
   ma_sine,    // sine weighted moving average
   ma_linr,    // linear regression value
   ma_ie2,     // IE/2
   ma_nlma,    // non lag moving average
   ma_zlma,    // zero lag moving average
   ma_lead,    // leader exponential moving average
   ma_ssm,     // super smoother
   ma_smoo     // smoother
};

As far as I know this is the last list of moving averages available as open code

(other MAs are already in ex4 format).

Reason: