Coding help - page 111

 

Thank you Very much! you are so good!

 

Hello,

Does anybody know an indicator that would plot only the swing point on the chart like describe bellow (like the one in Pipware Dashboard):

Fractal Breakout Strategy

As stated earlier, price action moves in waves. Trend direction (up or down) is determined by the consecutive highs and lows.

UP TREND is when these waves are making higher highs and higher lows.

DOWN TREND is when these waves are making lower lows and lower highs.

Because fractals are highs and lows, they can be used to determine trend direction.

Consider the GU H4 chart (right). Prior to point A the trend is upward ie the second low fractal is higher than the first .. the second high fractal is higher than the first.

A new low fractal formed at point A and is higher than the previous two low fractals (continuing the UP trend). The candle immediately after point A formed a new high fractal. This fractal is lower than it's previous high fractal indicating a possible change in trend direction. The candle under point B 'breaks' the fractal level of point A (green line). A red arrow is drawn indicating that the trend direction has changed to DOWN.

Arrows can be displayed by ArrowsOn=true. Note: arrows are drawn only when a fractal break changes trend direction. For example, after point B, the lower fractals continue to be broken (2 more times).

After point B, the trend is considered DOWN until a high fractal gets broken. Just prior to point C, a higher low fractal is formed. The trend direction is still considered DOWN ... no high fractal has been broken yet.

At point E, the high fractal of point C is broken. Even though it is a small break a green arrow is drawn at point D indicating a change in trend direction. The trend is now considered to be UP until the next low fractal break.

Many thanks for your help.

Best,

Gringoh

 

Thanks Mladen, it' s perfect!!! If I want to add another line to the indicator like this, how I mod the code? thanks in advance....

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

double UpperBuf[];

double UpperBuf1[];

double UpperBufb[];

double UpperBuf1b[];

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

//| |

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

void init()

{

IndicatorBuffers(4);

SetIndexBuffer(0, UpperBuf1);

SetIndexBuffer(1, UpperBuf1b);

SetIndexBuffer(2, UpperBuf);

SetIndexBuffer(3, UpperBufb);

}

void deinit() {}

void start()

{

int counted = IndicatorCounted();

if(counted < 0) return (-1);

if(counted > 0) counted--;

int limit = Bars - counted;

for(int i = 0; i < limit; i++)

if (Close!=0)

UpperBuf= ((High/Close)-34)*Volume;

else UpperBuf= 0;

for( i = 0; i < limit; i++) UpperBuf1= iMAOnArray(UpperBuf,0,33,0,MODE_EMA,i);

for( i = 0; i < limit; i++)

if (Close!=0)

UpperBufb= ((High/Close)-34)*Volume;

else UpperBufb= 0;

for( i = 0; i < limit; i++) UpperBuf1b= iMAOnArray(UpperBufb,0,33,0,MODE_EMA,i);

}

 
k3rn3l:
Thanks Mladen, it' s perfect!!! If I want to add another line to the indicator like this, how I mod the code? thanks in advance....

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

double UpperBuf[];

double UpperBuf1[];

double UpperBufb[];

double UpperBuf1b[];

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

//| |

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

void init()

{

IndicatorBuffers(4);

SetIndexBuffer(0, UpperBuf1);

SetIndexBuffer(1, UpperBuf1b);

SetIndexBuffer(2, UpperBuf);

SetIndexBuffer(3, UpperBufb);

}

void deinit() {}

void start()

{

int counted = IndicatorCounted();

if(counted < 0) return (-1);

if(counted > 0) counted--;

int limit = Bars - counted;

for(int i = 0; i < limit; i++)

if (Close!=0)

UpperBuf= ((High/Close)-34)*Volume;

else UpperBuf= 0;

for( i = 0; i < limit; i++) UpperBuf1= iMAOnArray(UpperBuf,0,33,0,MODE_EMA,i);

for( i = 0; i < limit; i++)

if (Close!=0)

UpperBufb= ((High/Close)-34)*Volume;

else UpperBufb= 0;

for( i = 0; i < limit; i++) UpperBuf1b= iMAOnArray(UpperBufb,0,33,0,MODE_EMA,i);

}

k3rn3l

You already did it (there are 2 lines on the indicator). If you mean one more (to have 3) simply do the same thing you did for the second line

 

dear coders,

i found this METASTOCK indicator very good, can you please make it for mt4?

x:=Input("Consecutive Lower Closes - Entry",

0,21,5);

y:=Input("Consecutive Higher Closes - Exit",

0,21,5);

delay:=Input("Entry and Exit delay",0,5,0);

plot:=Input("signals: [1]Clean, [2]All",

1,2,2);

In:=Sum(C<Ref(C,-1),x)=x;

Out:=Sum(C>Ref(C,-1),y)=y;

Init:=Cum(In+Out>-1)=1;

InInit:=Cum(In)=1;

flag:=BarsSince(Init OR In)

<BarsSince(Init OR Out)+InInit;

signals:=(InInit AND Alert(InInit=0,2)

OR flag AND Alert(flag=0,2))

-(flag=0 AND Alert(flag,2));

0;Ref(If(plot=1,signals,In-Out),-delay)

 
debashis:
dear coders,

i found this METASTOCK indicator very good, can you please make it for mt4?

x:=Input("Consecutive Lower Closes - Entry",

0,21,5);

y:=Input("Consecutive Higher Closes - Exit",

0,21,5);

delay:=Input("Entry and Exit delay",0,5,0);

plot:=Input("signals: [1]Clean, [2]All",

1,2,2);

In:=Sum(C<Ref(C,-1),x)=x;

Out:=Sum(C>Ref(C,-1),y)=y;

Init:=Cum(In+Out>-1)=1;

InInit:=Cum(In)=1;

flag:=BarsSince(Init OR In)

<BarsSince(Init OR Out)+InInit;

signals:=(InInit AND Alert(InInit=0,2)

OR flag AND Alert(flag=0,2))

-(flag=0 AND Alert(flag,2));

0;Ref(If(plot=1,signals,In-Out),-delay)

debashis

What is the name of that indicator?

 

guru

its call "basic pattern system". http://www.metastocktools.com/MetaStock/Pattern01.txt

 

Hi malden, thank you for help me with the ASCTrend. I am wondering if you could help me make a ea for this indicator. there is another indicator called MaonMa. (I will attach them ) My thought is when the ASCTrend arrows up AND the bar is above the yellow line(60 MA), put a long trade, stop lose will be the previous lowest, likewise, when the ASCTrend arrows down AND the bar is under the yellow line(60 MA), put a short trade, stop lose wiil be the previous highest. Thanks.

 

Hello Mladen,

i need your help again. i did set the following code for an arrow based indic. but its freezing pc. if it would prevent lagging, can you write the code again using the original rsi,cci and cmo codes in the indic without icustom function.

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Crimson

#property indicator_color2 RoyalBlue

//---- input parameters

extern int barsToProcess=100;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,233);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(1,234);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(1,0.0);

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int counted_bars=IndicatorCounted(),

limit;

if(counted_bars>0)

counted_bars--;

limit=Bars-counted_bars;

if(limit>barsToProcess)

limit=barsToProcess;

for(int i=0;i<limit;i++)

{

double rsi=iCustom(NULL,0,"rsi",barsToProcess,0,i);

double cci=iCustom(NULL,0,"cci",barsToProcess,0,i);

double cmo=iCustom(NULL,0,"cmo",barsToProcess,0,i);

if(rsi>60.0 && cci>150.0&&cmo>30.0)

ExtMapBuffer1=High+5*Point;

else

ExtMapBuffer1=0.0;

if(rsi<10.0 && cci<-150.0&&cmo<-30.0)

ExtMapBuffer2=Low-5*Point;

else

ExtMapBuffer2=0.0;

}

return(0);

}

 
anonimm:
Hello Mladen,

i need your help again. i did set the following code for an arrow based indic. but its freezing pc. if it would prevent lagging, can you write the code again using the original rsi,cci and cmo codes in the indic without icustom function.

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Crimson

#property indicator_color2 RoyalBlue

//---- input parameters

extern int barsToProcess=100;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,233);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(1,234);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(1,0.0);

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int counted_bars=IndicatorCounted(),

limit;

if(counted_bars>0)

counted_bars--;

limit=Bars-counted_bars;

if(limit>barsToProcess)

limit=barsToProcess;

for(int i=0;i<limit;i++)

{

double rsi=iCustom(NULL,0,"rsi",barsToProcess,0,i);

double cci=iCustom(NULL,0,"cci",barsToProcess,0,i);

double cmo=iCustom(NULL,0,"cmo",barsToProcess,0,i);

if(rsi>60.0 && cci>150.0&&cmo>30.0)

ExtMapBuffer1=High+5*Point;

else

ExtMapBuffer1=0.0;

if(rsi<10.0 && cci<-150.0&&cmo<-30.0)

ExtMapBuffer2=Low-5*Point;

else

ExtMapBuffer2=0.0;

}

return(0);

}

Instead of using iCustom() for rsi and cci use the built in functions.

Parameters needed for RSI :

[TD]string symbol, int timeframe, int period, int applied_price, int shift)
double iRSI([/TD] string symbol, int timeframe, int period, int applied_price, int shift)[/TD]

[/TR]

[/TABLE]

Parameters needed for CCI :

[TABLE="class: docvar"]

[TR]

[TD]double iCCI(

And for CMO, first parameter is LastBarOnly and the second is CMO_Range, so the iCustom() call should be something like :

iCustom(NULL,0,"cmo",false,CMORange,0,i);

where CMORange would be some parameter

Reason: