Monday – Friday : 9:00 AM – 6:30 PM

Candle Stick

The Candle Stick AFL is a free option that relies on Amibroker data for pattern recognition. Traders can utilize free Amibroker data feeds to spot candlestick patterns on their charts, helping them identify potential trend reversals or continuations. Access to reliable Amibroker data enhances the effectiveness of this AFL.

//  This program takes a segment from your price chart and substitutes the last
//  bar visible with a representative Candle stick for the period selected. It
//  allows you to observe how candles are formed and how loss of
//  synchronization of the Candle period, or using different time frames, can
//  result in totally different chart patterns for the same price array.

_SECTION_BEGIN("Candle Stick Demo");
// Candlestick demo by herman van den Bergen
BI				= BarIndex();
barvisible 	= Status("barvisible");
FirstBarIndx= LastValue( Lowest(ValueWhen(BarVisible,BI)));
LastBarIndx	= LastValue( Highest(ValueWhen(BarVisible,BI)));
FirstBarVis = FirstBarIndx == BI; 
LastBarVis 	= LastBarIndx == BI; 

Width=Param("Bar Width",5,1,30,1);
EndCandle = SelectedValue(BarIndex())+int(Width/2)+1; 
StartCandle = Endcandle-Width;
CandleData = Flip(StartCandle == BI,EndCandle == BI);

MAsk2 = IIf(BI>=StartCandle,1,Null);
MAsk1 = IIf(CandleData OR LastBarVis, 1, Null);

Oc = LastValue(ValueWhen(StartCandle == BI, O));
Hc = LastValue(ValueWhen(CandleData , HHV(H,Width)));
Lc = LastValue(ValueWhen(CandleData , LLV(L,Width)));
CC = LastValue(ValueWhen(CandleData , C));

O = IIf( LastBarVis, Oc, O);
H = IIf( LastBarVis, HC, H);
L = IIf( LastBarVis, LC, L);
C = IIf( LastBarVis, CC, C);

if( Param("Style: Candle/Bar",0,0,1,1) == 0 ) BarStyle = 64; else BarStyle = 128; 
Plot(C,"",1,BarStyle |styleNoLabel|styleThick);

Co1 = Param("BackGroundColor",47,0,64,1);
Co2 = Param("CandleAreaColor",39,0,64,1);

Title="\nCandlestick Demo\n"+
"Candle Date:   "+Date()+"\n"+
"Candle Width:   "+NumToStr(Width,1.0)+" bars\n";

GraphXSpace = 5;

Open chat
Hi, how can I help you?