Simple Coding Help - No Promise.

Is it possible to decode it like in this screen shot. Red and green lines are bands based on keltner channel of TEMA high and TEMA low.


2 afls
1) Keltner bands along with OBV
2) Keltner band along with price action

Thanks a lot in advance HAPPY
Its simple, he has just dragged and dropped the indicators on to the chart

However all the indicators/params are not seen in the Title as it has less space (i.e its going beyond the screen size)
but whatever is seen in the title can be reproduced.

BTW the same trader has disclosed his method and answered to members queries on Mudra,
anyone interested can check there, use google he uses same ID there

Happy :)
 
Its simple, he has just dragged and dropped the indicators on to the chart

However all the indicators/params are not seen in the Title as it has less space (i.e its going beyond the screen size)
but whatever is seen in the title can be reproduced.

BTW the same trader has disclosed his method and answered to members queries on Mudra,
anyone interested can check there, use google he uses same ID there

Happy :)
Thanks Happy.

I have tried by drag and drop but i failed to create.All i am looking from above posted chart is

Pane1 :- 1) Along with OBV Another line TEMA(OBV,36) and KBTop(BBTop(TEMA(OBV,36)8,2),8,0.4) and KBbot(BBTop(TEMA(OBV,36)8,2),8,0.4)


Pane 2 :- Almost similar like above but I can try to mimic if you are able to help me with Pane 1 AFL :)

KBTop(TEMA(HIGH,8),8,0.4) and KBbot(TEMA(HIGH,8),8,0.4)

I am trying to use this along with my mixer system :lol::lol:.

Thanks a lot in advance
 
Thanks Happy.

I have tried by drag and drop but i failed to create.All i am looking from above posted chart is

Pane1 :- 1) Along with OBV Another line TEMA(OBV,36) and KBTop(BBTop(TEMA(OBV,36)8,2),8,0.4) and KBbot(BBTop(TEMA(OBV,36)8,2),8,0.4)


Pane 2 :- Almost similar like above but I can try to mimic if you are able to help me with Pane 1 AFL :)

KBTop(TEMA(HIGH,8),8,0.4) and KBbot(TEMA(HIGH,8),8,0.4)

I am trying to use this along with my mixer system :lol::lol:.

Thanks a lot in advance
Drop them in the sequence they appear and then setup the parameters after pasting.

Anyway here is the code, just setup parameters . . .

For TEMA use OBV as Price Field
For BB use TEMA as Price Field
For first Ketler band use BBTop as Price Field
For second Ketler band use BBBot as Price Field

Also adjust other parameters as per your requirement

Code:
_SECTION_BEGIN("OBV");
Plot( OBV(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style")  );
_SECTION_END();


_SECTION_BEGIN("TEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( TEMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); 
_SECTION_END();

_SECTION_BEGIN("Keltner Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style", styleLine | styleNoLabel);

CenterLine = MA( P, Periods );
KTop = CenterLine + Width * ATR( Periods );
KBot = CenterLine - Width * ATR( Periods );

Plot( KTop, "KBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( KBot, "KBBot" + _PARAM_VALUES(), Color, Style ); 
_SECTION_END();


_SECTION_BEGIN("Keltner Bands1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style", styleLine | styleNoLabel);

CenterLine = MA( P, Periods );
KTop = CenterLine + Width * ATR( Periods );
KBot = CenterLine - Width * ATR( Periods );

Plot( KTop, "KBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( KBot, "KBBot" + _PARAM_VALUES(), Color, Style ); 
_SECTION_END();




BTW, i don't even think this was done intentionally, :lol:
that's the way AB works when we drag n drop new indi's on the chart
taking the previous indicator as input for next one :)

anyway no harm in experimenting . . . . :thumb:

Happy :)
 
Last edited:
Hi again

Instead of using such a clutter of superimposed indicators, we can simply modify
the OBV or any other line / wiggle type indicator to be plotted at a Histogram . . .

Code:
_SECTION_BEGIN("On Balance Volume");
Ob		=	OBV();	
eOb 	=	EMA(Ob,34);
delta	=	Ob - eOb;  			//Difference in Ob & its EMA
ObCol	=	IIf(eOb > Ref(eOb,-1),ColorRGB(60,60,180),ColorRGB(180,20,20)); 

Plot(delta,"Delta",ObCol,styleThick|styleHistogram);
Plot(delta,"",ObCol,styleNoLabel);
Plot(0, "", ObCol,styleNoLabel|styleThick);
_SECTION_END();
Cheers


Happy :)
 
Drop them in the sequence they appear and then setup the parameters after pasting.

Anyway here is the code, just setup parameters . . .

For TEMA use OBV as Price Field
For BB use TEMA as Price Field
For first Ketler band use BBTop as Price Field
For second Ketler band use BBBot as Price Field

Also adjust other parameters as per your requirement

Code:
_SECTION_BEGIN("OBV");
Plot( OBV(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style")  );
_SECTION_END();


_SECTION_BEGIN("TEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( TEMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); 
_SECTION_END();

_SECTION_BEGIN("Keltner Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style", styleLine | styleNoLabel);

CenterLine = MA( P, Periods );
KTop = CenterLine + Width * ATR( Periods );
KBot = CenterLine - Width * ATR( Periods );

Plot( KTop, "KBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( KBot, "KBBot" + _PARAM_VALUES(), Color, Style ); 
_SECTION_END();


_SECTION_BEGIN("Keltner Bands1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style", styleLine | styleNoLabel);

CenterLine = MA( P, Periods );
KTop = CenterLine + Width * ATR( Periods );
KBot = CenterLine - Width * ATR( Periods );

Plot( KTop, "KBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( KBot, "KBBot" + _PARAM_VALUES(), Color, Style ); 
_SECTION_END();




BTW, i don't even think this was done intentionally, :lol:
that's the way AB works when we drag n drop new indi's on the chart
taking the previous indicator as input for next one :)

anyway no harm in experimenting . . . . :thumb:

Happy :)
You are simply AFL ROCKSTAR

Thanks a lot:clap::clap:
 

vijkris

Learner and Follower
Hi again

Instead of using such a clutter of superimposed indicators, we can simply modify
the OBV or any other line / wiggle type indicator to be plotted at a Histogram . . .

Code:
_SECTION_BEGIN("On Balance Volume");
Ob		=	OBV();	
eOb 	=	EMA(Ob,34);
delta	=	Ob - eOb;  			//Difference in Ob & its EMA
ObCol	=	[U]IIf(eOb > Ref(eOb,-1),C[/U]olorRGB(60,60,180),ColorRGB(180,20,20)); 

Plot(delta,"Delta",ObCol,styleThick|styleHistogram);
Plot(delta,"",ObCol,styleNoLabel);
Plot(0, "", ObCol,styleNoLabel|styleThick);
_SECTION_END();
Cheers


Happy :)
Hi, No offence, but..

can any one explain the purpose of comparing ema with prev ema ? (code underlined )
Why ob and prev ob is not compared ?
 
Hi, No offence, but..

can any one explain the purpose of comparing ema with prev ema ? (code underlined )
Why ob and prev ob is not compared ?
In case of OBV, every green bar it increases and every red bar it decreases
so just looking at candle you will know if its increasing or not
no need to compare :)

EMA (or any other average) is used for smoothening the original data series
Comparing tells us if it is rising or falling (choice of period is important)

One interesting fact about OBV is that
in this particular case eOb > Ref(eOb,-1) is same as Ob > eOb
i.e cross of indicator above/below the moving average . . . .

Think about it, is it always so ? why ??

Happy :)
 
Happy Ji,

I am trying to write my First AFL for opening Range breakout.
Getting some issues here. I can get code from web easily, but want to write it on my own to learn it.

Here is the issue I am facing:

I am using 1 Min Chart for last 30 days.
To find out High of first 15 min, I am using this code:

tn = TimeNum();

ObservationStartTime = 91559;
ObservationEndtime = 92959;

StartBar = tn == ObservationStartTime;
EndBar = tn == ObservationEndtime;

OpeningHourHigh = ValueWhen( EndBar, HighestSince( StartBar, High ) );
OpeningHourLow = ValueWhen( EndBar, LowestSince( StartBar, Low ) );

OpenHourRangeValue = OpeningHourHigh - OpeningHourLow;

Issues:
1. On Day 2, from time 09:15 to 09:30, the chart displays previous day's Opening Hour High Low values. I want it to be reset on Market close. I tried various options last night. But nothing fruitful so far.
2. OpeningHourHigh, OpeningHourLow, OpenHourRangeValue - all these values are of Array Type. I don't get it. Why are they of Array Type? They should be of numeric type because I am finding High of few bars and Low of few bars. Then subtracting those.

If I do Lowest(OpeningHourLow), on day 4, it returns me Low of last 4 days lowest value in opening hours, which is not good. I believe even if I am assigning it with '=', Ami is pushing that new value in that array.

Can I explicitly declare these variables to be of number type and not to push new values, but only to remember newest value?

Kindly let me know what I am doing wrong here? Any guidelines / links to learn will be appreciated. I am a programmer by profession. So, I believe I can pick it up quickly, but currently need to know why these functions return types are arrays and not only the number.

Thanks
 
Happy Ji,

I am trying to write my First AFL for opening Range breakout.
Getting some issues here. I can get code from web easily, but want to write it on my own to learn it.

Here is the issue I am facing:

I am using 1 Min Chart for last 30 days.
To find out High of first 15 min, I am using this code:

tn = TimeNum();

ObservationStartTime = 91559;
ObservationEndtime = 92959;

StartBar = tn == ObservationStartTime;
EndBar = tn == ObservationEndtime;

OpeningHourHigh = ValueWhen( EndBar, HighestSince( StartBar, High ) );
OpeningHourLow = ValueWhen( EndBar, LowestSince( StartBar, Low ) );

OpenHourRangeValue = OpeningHourHigh - OpeningHourLow;

Issues:
1. On Day 2, from time 09:15 to 09:30, the chart displays previous day's Opening Hour High Low values. I want it to be reset on Market close. I tried various options last night. But nothing fruitful so far.
2. OpeningHourHigh, OpeningHourLow, OpenHourRangeValue - all these values are of Array Type. I don't get it. Why are they of Array Type? They should be of numeric type because I am finding High of few bars and Low of few bars. Then subtracting those.

If I do Lowest(OpeningHourLow), on day 4, it returns me Low of last 4 days lowest value in opening hours, which is not good. I believe even if I am assigning it with '=', Ami is pushing that new value in that array.

Can I explicitly declare these variables to be of number type and not to push new values, but only to remember newest value?

Kindly let me know what I am doing wrong here? Any guidelines / links to learn will be appreciated. I am a programmer by profession. So, I believe I can pick it up quickly, but currently need to know why these functions return types are arrays and not only the number.

Thanks
Hi Tarun

Many versions of ORB are already shared even on traderji, please search you will find the AFL,
one of the version is shared by our Angubai, he has traded it extensively and also share his experience with it.


Happy :)


some examples

1) http://www.traderji.com/amibroker/52959-augubhais-orb-system.html
2) http://www.traderji.com/day-trading/89936-opening-range-breakout-orb-intraday-trading-system.html

many more available if you search
 
Hi Tarun

Many versions of ORB are already shared even on traderji, please search you will find the AFL,
one of the version is shared by our Angubai, he has traded it extensively and also share his experience with it.


Happy :)


some examples

1) http://www.traderji.com/amibroker/52959-augubhais-orb-system.html
2) http://www.traderji.com/day-trading/89936-opening-range-breakout-orb-intraday-trading-system.html

many more available if you search


Thanks Happy Ji,

I think I came across first one last night. But the way that code is written seems little complex for me as a beginner. So, I wanted to write it on my own using simple steps.

Can you clarify my doubt number 2? Why arrays? And how to find / convert it to the single numeric value?

The reason why I want to write on my own is - I want to tweak it to my comfort. So, it's better for me I learn it properly instead of copy paste and done.

Sent from my iPhone using Tapatalk
 

Similar threads