Australian (ASX) Stock Market Forum

Amibroker FAQ

Thanks Gringotts. I was then looking for price to close back down below the high of the previous pivot.
I don't think that can be done if the swing is calculated using Zig eg:

Buy = H>(Ref(swinghi,-1)) AND C<(Ref(swinghi,-1)) ;



I've been trying this but for some reason AB won't have it and misses many signals :confused:

Logic seems correct to me.:confused:

SwingHi= H>Ref(H,-1) AND H>Ref(H,1);
BO= (L>ValueWhen(swingHi,H,1)) AND (C<ValueWhen(swingHI,H,1));
PlotShapes(shapeSmallCircle*SWINGHi,colorBLUE, 0, H, 20);

Buy = SwingHi;

This is the JHX daily chart for example. Note no green arrow buy signal on yesterday's candlestick? But there was one correctly identified 4 days ago.

View attachment 66545


Plot this, so you can see the zig line, then backtest. You'll see it works for what you want.

[edited]


swinghi= Peak(H,5,1);
Buy = H>ref(swinghi,-1) AND C<Ref(swinghi,-1);
Sell = False;
Plot(Zig(H,5),"",colorBlack);
 
Plot this.

swinghi= Peak(H,.5,1);
Buy = H>ref(swinghi,-1) AND C<Ref(swinghi,-1);
Sell = False;
Plot(Zig(H,.5),"",colorBlack);


shape = Buy * shapesmalluptriangle;// + Sell * shapeHollowDownArrow;

PlotShapes( shape, IIf( Buy, Colorgreen, colorPink ), 0, IIf( Buy , Low, High ), -20 );

_SECTION_BEGIN("Price1");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
 
Plot this, so you can see the zig line, then backtest. You'll see it works for what you want.

[edited]


swinghi= Peak(H,5,1);
Buy = H>ref(swinghi,-1) AND C<Ref(swinghi,-1);
Sell = False;
Plot(Zig(H,5),"",colorBlack);

Thanks for your help Gringotts Bank
 
Thanks for your help Gringotts Bank

This is prettier. I think Pottasch wrote the base code.





_SECTION_BEGIN("Price1");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
SetChartBkGradientFill(ColorRGB(229,229,229),ColorRGB(229,229,229));
_SECTION_END();

nbar = Param("nbar",5,2,50,1); // number of bars on each side

// define fractals
PHigh = H > Ref(HHV(H,nbar),-1) AND Ref(HHV(H,nbar),nbar) <= H;
PHighPrice = ValueWhen(PHigh,H);

PLow = L < Ref(LLV(L,nbar),-1) AND Ref(LLV(L,nbar),nbar) >= L;
PLowPrice = ValueWhen(PLow,L);

// chart
GraphXSpace = 5;
SetChartOptions(0, chartShowDates);

PriorHigh = ValueWhen(PLow,PHighPrice);
PriorLow = ValueWhen(PHigh,PLowPrice);
Plot( xh = Ref(PHighPrice,-nbar), "High",colorBlue );
Plot( xl = Ref(PLowPrice,-nbar), "Low",colorBrown );

Buy = H>xh AND C<xh; // do not generate signals
Sell = 0;

shape = Buy * shapesmalluptriangle;// + Sell * shapeHollowDownArrow;

PlotShapes( shape, IIf( Buy, Colorgreen, colorPink ), 0, IIf( Buy , Low, High ), -20 );
 
Hi chipotle

SwingHi= H>Ref(H,-1) AND H>Ref(H,1);

Beware as the code in bold red references the future.
The blue dots on your chart which represent a swinghi will not plot until the next bar is known!

The code below should give a value of 1 on the breakout bar.

SwingHi = Ref(H,-2)<Ref(H,-1) AND Ref(H,-1)>H;
LastSHH = ValueWhen(1,SwingHi,Ref(H,-1));
breakout = Cross(H,LastSHH);
breakout
 
Thank you Gringotts bank.

Thanks rnr. I couldn't get the code to work but thanks for you effort

There's nothing to get working as such. You just copy/paste into a window then backtest.

High above line, closes below. This is what you asked for.

Or if you want cross and close below, simply change buy line to:
Buy = cross(H,xh) AND C<xh;

x.png
 
At the end you have to change the >= -40 to <= -40 for a negative number. Also your 10 conditions use a specific Close price back from 10 bars to 180 bars ago. So you are getting the % change for each specific referenced Close. Mine referenced the High.

Hope this helps.

Oh yeah the symbol. Oh okay i see it now with the reference. Thanks.
 
Re: Amibroker Exploration Question and other questions

Hi,
May i know what function would you use ? If you want to make something like ?
KIndly reply
I wrote question in picture..

The exploration returns the search for a condition and that condition could be plotted on the chart.
 
Re: Amibroker Exploration Question and other questions

The exploration returns the search for a condition and that condition could be plotted on the chart.

Hi Wysiwyg,
thanks
In my question, it's under Buy column, its results xyz under Buy column ..
I don't wanna put them below candlestick charts.. means
exploration done 15/5/2016 1:05pm xyz(that is results under Buy column)
=> it just put xyz under Buy column .

again exploration done 15/5/2016 1:10pm yzm(that is result under Buy column, m a new value )
=> Now candlestick is next candlestick ,Now i wanna put it yzm under that candlestick ..

May i know , How would you do it?
and it's possible?
sn4XLWy.png

http://i.imgur.com/sn4XLWy.png

Kindly may i know what function would you use do it? align that exploration results of a column to under candlestick?

regards
 
something like this will plot a green circle below the bar.

PlotShapes(shapeSmallCircle*Buy,colorGreen,0,Low,-20);
 
something like this will plot a green circle below the bar.

PlotShapes(shapeSmallCircle*Buy,colorGreen,0,Low,-20);

Hi Wysiwyg,
thanks
In my question, it's under Buy column, its results xyz under Buy column ..
I don't wanna put them below candlestick charts.. means
exploration done 15/5/2016 1:05pm xyz(that is results under Buy column)
=> it just put xyz under Buy column .

again exploration done 15/5/2016 1:10pm yzm(that is result under Buy column, m a new value )
=> Now candlestick is next candlestick ,Now i wanna put it yzm under that candlestick ..

May i know , How would you do it?
1. and it's possible?

View attachment 66693

http://i.imgur.com/sn4XLWy.png

2. Kindly may i know what function would you use do it? align that exploration results of a column to under candlestick?( How do you put those values under candlestick?)

regards

Hi,
MY main question is different, but thanks for answer. I've pointed it with point 1 and point 2.
with picture .. easier to under question .. If you need more explanation, let me know, i've described it in details already .
 
Just wondering if you are trying to find an edge in going long on a 40% or more price decline over some period?

Sorry for the late reply Wysi, only saw the quote today. Yeah, my reversal set up for stock and stock index on daily or weekly chart. There's no specific time period for the decline but the stock needs to show strong downward trend/momentum and minimum of 40% drop from most recent high. Then use indicator adx and macd/ppo to look for divergence and use price action to enter. Same for exit divergence or price action.
 
Hi Wysiwyg,
thanks
In my question, it's under Buy column, its results xyz under Buy column ..
I don't wanna put them below candlestick charts.. means
exploration done 15/5/2016 1:05pm xyz(that is results under Buy column)
=> it just put xyz under Buy column .

again exploration done 15/5/2016 1:10pm yzm(that is result under Buy column, m a new value )
=> Now candlestick is next candlestick ,Now i wanna put it yzm under that candlestick ..

May i know , How would you do it?
and it's possible?
View attachment 66693

http://i.imgur.com/sn4XLWy.png

Kindly may i know what function would you use do it? align that exploration results of a column to under candlestick?

regards


Hi,
MY main question is different, but thanks for answer. I've pointed it with point 1 and point 2.
with picture .. easier to under question .. If you need more explanation, let me know, i've described it in details already .


Hi,
i post these two picture again WITH FORMULA YOU CAN TRY WITH.
47MtPBa.png
sn4XLWy.png

AND FORMULA :
Code:
SetOption("NoDefaultColumns", True ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime(); 
 filter = 0;

for(i=1; i<=10; i++) { 

   TimeframeSet(i * in1Minute);
   
   up= C>O; 

   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t"; 
 

   x= StrFormat("%02g-min", i);
   bar = bar+ WriteIf(up,  x, "\t");

  
        addRow(bar );
    
  TimeframeRestore();  
m1 = TimeFrameExpand(up,in1Minute);

}

I WANT TO USE THIS CODE AS EXAMPLE, AND WANT TO PLOT AS PER UNDER CANDLESTICK, AS I WRITTEN IN PICTURE. WHAT DO YOU ADD IN CODE TO MAKE IT LIKE UP?
I WISH QUESTION IS NEAT AND CLEAR , TRIED TO WRITE AS SIMPLE AS POSSIBLE AND IN GRAPHIC WAY. LET ME KNOW IF ANYTHING NEED TO BE ADDED


REGARDS
 
Hi,
i post these two picture again WITH FORMULA YOU CAN TRY WITH.
View attachment 66700
View attachment 66701

AND FORMULA :
Code:
SetOption("NoDefaultColumns", True ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime(); 
 filter = 0;

for(i=1; i<=10; i++) { 

   TimeframeSet(i * in1Minute);
   
   up= C>O; 

   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t"; 
 

   x= StrFormat("%02g-min", i);
   bar = bar+ WriteIf(up,  x, "\t");

  
        addRow(bar );
    
  TimeframeRestore();  
m1 = TimeFrameExpand(up,in1Minute);

}

I WANT TO USE THIS CODE AS EXAMPLE, AND WANT TO PLOT AS PER UNDER CANDLESTICK, AS I WRITTEN IN PICTURE. WHAT DO YOU ADD IN CODE TO MAKE IT LIKE UP?
I WISH QUESTION IS NEAT AND CLEAR , TRIED TO WRITE AS SIMPLE AS POSSIBLE AND IN GRAPHIC WAY. LET ME KNOW IF ANYTHING NEED TO BE ADDED


REGARDS

I've had a look and I'm sorry, I don't understand.

If you have a friend who speaks English well, get him to write exactly what you want.
 
Hi,
i post these two picture again WITH FORMULA YOU CAN TRY WITH.
View attachment 66700
View attachment 66701

AND FORMULA :
Code:
SetOption("NoDefaultColumns", True ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime(); 
 filter = 0;

for(i=1; i<=10; i++) { 

   TimeframeSet(i * in1Minute);
   
   up= C>O; 

   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t"; 
 

   x= StrFormat("%02g-min", i);
   bar = bar+ WriteIf(up,  x, "\t");

  
        addRow(bar );
    
  TimeframeRestore();  
m1 = TimeFrameExpand(up,in1Minute);

}

I WANT TO USE THIS CODE AS EXAMPLE(the exploration code that i wrote ), AND WANT TO PLOT AS PER UNDER CANDLESTICK(kindly see hZmp66h.png), AS I've WRITTEN IN PICTURE([hZmp66h.png). WHAT DO YOU ADD IN CODE TO MAKE IT LIKE UP?(this means, If i want ouput under candlestick, as i described in pic(same pic i posted two pic here), What modification do i need in code?)
I WISH QUESTION IS NEAT AND CLEAR , TRIED TO WRITE AS SIMPLE AS POSSIBLE AND IN GRAPHIC WAY. LET ME KNOW IF ANYTHING NEED TO BE ADDED


REGARDS

Hi GB,
I've shown this to native folks, they understood everything. Kindly let me know , what are you not understanding?
I try to explain more in Fire brick color.
their grammer is worse than me .
If you not understanding anything, Kindly let me know that specific line , i will try to explain it more,

Post a screen shot of your exploration, that might help

nbxUsoW.png

Roller_1, you can put in your database and see it .
 
HI,
Function might be used ..
with exploration .

PLot function : Plot( array, name, color/barcolor, style = styleLine, minvalue = {empty}, maxvalue = {empty}, XShift = 0, Zorder = 0, width = 1 )

PlotShapes(shapeSmallCircle*Buy,colorGreen,0,Low,-20); //Roller_1

LOoping through bars:

for(i=0;i<BarCount-1;i++)
//looping through bars
{
if(r==True)PlotText(":", i, colorRed, bkcolor = colorDefault); // Just an example
}


But wait . Plottext is used to draw value under candlestick ..and It has predefined value, which means it doesn't accept array. dynamic array.. maybe..

but Can't we d

PlotText("fixvaluelike : ;; " + WriteVal(array))'

Writeval(array) pass dynamic array and , and we can align it with plottext ?
can't we do it like this ? or plottext only used for predefined set of text only .

Can't we use it like this ?
 
Top