Coding help - page 175

 

hi mladen,

1.you mention second form, of from older to newer bars, are you saying this style: for (i=limit;i>=0;i--)?

i afraid confused, so ask little clarification.

2.ask also, are both styles(if not consider repaint or not) basically give same signals or numerical value?

3. can an indicator contain both styles of loop direction?like the core indicator part is second form, but the mtf part is first form style? any contradiction here ? or still can run smoothly?

4. lack of some return(0) sentences,(is return(0) sentence a must or necessary ?) will it be a problem to halt indicator or cause repaintness? thanks

 
kenwa:
hi mladen,

1.you mention second form, of from older to newer bars, are you saying this style: for (i=limit;i>=0;i--)?

i afraid confused, so ask little clarification.

2.ask also, are both styles(if not consider repaint or not) basically give same signals or numerical value?

3. can an indicator contain both styles of loop direction?like the core indicator part is second form, but the mtf part is first form style? any contradiction here ? or still can run smoothly?

4. lack of some return(0) sentences,(is return(0) sentence a must or necessary ?) will it be a problem to halt indicator or cause repaintness? thanks

1. yes

2. depends on the calculation done within the loop - some calculations can not be done in the "newer-to-older" form while all calculations can be done in the "older-to-newer" form

3. it can but see point 2 - the first form is much safer

4. return(0) can not cause or prevent repainting - it has nothing in common with it

 
mladen:
1. yes

2. depends on the calculation done within the loop - some calculations can not be done in the "newer-to-older" form while all calculations can be done in the "older-to-newer" form

3. it can but see point 2 - the first form is much safer

4. return(0) can not cause or prevent repainting - it has nothing in common with it

may i ask i) if second form can done all types of calculation, why not second form is more safer? i am bit confused.

also ii) i see the code you correct my previous indicator before is using (i=limit;i>=0;i--) the second form which my very beginning one is using first form style, any particular reason using second style ? thanks.

 
kenwa:
may i ask i) if second form can done all types of calculation, why not second form is more safer? i am bit confused. also ii) i see the code you correct my previous indicator before is using (i=limit;i>=0;i--) the second form which my very beginning one is using first form style, any particular reason using second style ? thanks.

What I meant to say is the form from the point 1. Use that form and you will eliminate a possible error from a wrong calculation direction

 
mladen:
What I meant to say is the form from the point 1. Use that form and you will eliminate a possible error from a wrong calculation direction

hi mladen,

if i not understand wrong, you means second form can adapt all type of calculation, but safer is first form which prevent some wrong calculation direction?

well, if my core indicator part use second form, and my mtf part use first form , is it ok? or it is better both the same form? (first form better??)

which form? first or second form is better eliminate possibility of repaint ? thanks for your patience answers my enquiry.

 
kenwa:
hi mladen,

if i not understand wrong, you means second form can adapt all type of calculation, but safer is first form which prevent some wrong calculation direction?

well, if my core indicator part use second form, and my mtf part use first form , is it ok? or it is better both the same form? (first form better??)

which form? first or second form is better eliminate possibility of repaint ? thanks for your patience answers my enquiry.

kenwa

to clear it : this is the much better form

(i=limit;i>=0;i--)

 

Ok & many thanks - I will get a few more results together before I come back!

jeff

 

Help me to solve this problem regarding fantail vma

Hi,

I am trying to learn mql for the last several months. I was trying to create an EA based on Fisher indicator. But as we know Fisher repaints, it gave me a hard time to create that EA. That is why I became demotivated and became busy with my studies. Now I am trying to create another EA based on FANTAIL. But I am facing problem to get bring the values from the indicator to the EA. I used iCustom function to do that. This indicator draws 50 lines in the chart. I will need some of the values from those lines.

Can you please show me a way to get those values in an EA? Thank you in advance. Sorry if I am asking a stupid question.

The indicator:

Files:
 

Hi mladen, can you help me to include the supertrend in this indicator?(Naturally, the supertrend calculated on ExtMapBuffer1)

#property indicator_separate_window

#property indicator_buffers 1

#property indicator_color1 DodgerBlue

extern double Beta1 = 1.0;

extern string Symbol2 = "GBPUSD";

extern double Beta2 = 1.4;

//--- buffers

double ExtMapBuffer1[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,ExtMapBuffer1);

IndicatorShortName(Symbol() + " " + Beta1 + " " + Symbol2 + " " + Beta2);

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int counted_bars=IndicatorCounted();

if(Bars<1) return(0);

int i = Bars-counted_bars -1;

while(i >=0) {

int iShift2 = iBarShift(Symbol2, 0, Time, false);

ExtMapBuffer1 = Close * Beta1 - iClose(Symbol2, NULL, iShift2) * Beta2;

i--;

}

return(0);

}

 
k3rn3l:
Hi mladen, can you help me to include the supertrend in this indicator?(Naturally, the supertrend calculated on ExtMapBuffer1)

#property indicator_separate_window

#property indicator_buffers 1

#property indicator_color1 DodgerBlue

extern double Beta1 = 1.0;

extern string Symbol2 = "GBPUSD";

extern double Beta2 = 1.4;

//--- buffers

double ExtMapBuffer1[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,ExtMapBuffer1);

IndicatorShortName(Symbol() + " " + Beta1 + " " + Symbol2 + " " + Beta2);

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int counted_bars=IndicatorCounted();

if(Bars<1) return(0);

int i = Bars-counted_bars -1;

while(i >=0) {

int iShift2 = iBarShift(Symbol2, 0, Time, false);

ExtMapBuffer1 = Close * Beta1 - iClose(Symbol2, NULL, iShift2) * Beta2;

i--;

}

return(0);

}

Which one exactly (because of the parameters needed to be passed to iCustom() function)?