Need hlep on AFL code for Multi TF ribbon

#1
Dear Friends,

I will be obliged to get some help with AFL code. MY AFL coding experience is basic and I am in the learning process.

I am trying to have multiple timeframe ribbon with Green, Red or Grey Color

The ribbon will have 4 stacks. Each Dash is corresponding to one candle



15MIN_RSI14 ----------------------------

15MIN_RSI23 ----------------------------

1Hours - - - - - - - - - - - - - - - -

Daily ------------------------

My Logic is as follows:

Daily Timeframe And 1hour timeframe

RSI(23) > 70 ( ribbon RED)

RSI(23) < 30 ( ribbon RED)

Else ribbon color GREEN



For 15 Minute timeframe

RSI (14) >50 (ribbon GREEN)

RSI (14) <50 (ribbon RED)



RSI(23)>70 (ribbon YELLOW)

RSI(23)>60 BUT RSI(23)<70 ( ribbon BLUE)

RSI(23)<40 BUT RSI(23)>30 ( ribbon BLUE)

RSI(23)<30 (ribbon YELLOW)

Else Ribbon color is GREY

Base timeframe will be 15 Minutes

I am not able to code this ribbon part. I tried to search in Traderji but cannot get this type of code where ribbon color is dependent on multiple conditions.

Can anyone help in getting the code for the ribbon? If you can guide me to the appropriate code snippet also , that will be of great help,

I am attaching the code that I have written till now:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

_SECTION_BEGIN("Daily");

TimeFrameSet(inDaily);

AD = RSI(23)>70;

BD = RSI(23)<30;

CD = RSI(23)<70 AND RSI(23)>30;

TimeFrameRestore();

_SECTION_END();



_SECTION_BEGIN("Hourly");

TimeFrameSet( inHourly); // switch to Hourly frame);

AH = RSI(23)>70;

BH = RSI(23)<30;

CH = RSI(23)<70 AND RSI(23)>30;

TimeFrameRestore();

_SECTION_END();



_SECTION_BEGIN("15Minute");

//TimeFrameSet( in15Minute ); // switch to 15 minute frame);

A14MU = RSI(14)>50;

A14MD = RSI(14)<50;

A23MU = RSI(23)> 60 AND RSI(23) <70;

A23MD = RSI(23)> 30 AND RSI(23) <40;

A23N = RSI(23)> 39 AND RSI(23) <59

//TimeFrameRestore();

_SECTION_END();
 

Romeo1998

Well-Known Member
#2
Dear Friends,

I will be obliged to get some help with AFL code. MY AFL coding experience is basic and I am in the learning process.

I am trying to have multiple timeframe ribbon with Green, Red or Grey Color

The ribbon will have 4 stacks. Each Dash is corresponding to one candle



15MIN_RSI14 ----------------------------

15MIN_RSI23 ----------------------------

1Hours - - - - - - - - - - - - - - - -

Daily ------------------------

My Logic is as follows:

Daily Timeframe And 1hour timeframe

RSI(23) > 70 ( ribbon RED)

RSI(23) < 30 ( ribbon RED)

Else ribbon color GREEN



For 15 Minute timeframe

RSI (14) >50 (ribbon GREEN)

RSI (14) <50 (ribbon RED)



RSI(23)>70 (ribbon YELLOW)

RSI(23)>60 BUT RSI(23)<70 ( ribbon BLUE)

RSI(23)<40 BUT RSI(23)>30 ( ribbon BLUE)

RSI(23)<30 (ribbon YELLOW)

Else Ribbon color is GREY

Base timeframe will be 15 Minutes

I am not able to code this ribbon part. I tried to search in Traderji but cannot get this type of code where ribbon color is dependent on multiple conditions.

Can anyone help in getting the code for the ribbon? If you can guide me to the appropriate code snippet also , that will be of great help,

I am attaching the code that I have written till now:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

_SECTION_BEGIN("Daily");

TimeFrameSet(inDaily);

AD = RSI(23)>70;

BD = RSI(23)<30;

CD = RSI(23)<70 AND RSI(23)>30;

TimeFrameRestore();

_SECTION_END();



_SECTION_BEGIN("Hourly");

TimeFrameSet( inHourly); // switch to Hourly frame);

AH = RSI(23)>70;

BH = RSI(23)<30;

CH = RSI(23)<70 AND RSI(23)>30;

TimeFrameRestore();

_SECTION_END();



_SECTION_BEGIN("15Minute");

//TimeFrameSet( in15Minute ); // switch to 15 minute frame);

A14MU = RSI(14)>50;

A14MD = RSI(14)<50;

A23MU = RSI(23)> 60 AND RSI(23) <70;

A23MD = RSI(23)> 30 AND RSI(23) <40;

A23N = RSI(23)> 39 AND RSI(23) <59

//TimeFrameRestore();

_SECTION_END();
Sir @addadutta
this will be helpful
good luck :)

Code:
TimeFrameSet(inDaily);
AD = RSI(23)>70;
BD = RSI(23)<30;
CD = RSI(23)<70 AND RSI(23)>30;
TimeFrameRestore();

ad = TimeFrameExpand(ad,inDaily);
bd = TimeFrameExpand(bd,inDaily);
cd = TimeFrameExpand(cd,inDaily);

daily_rib_col = IIf(ad OR bd,4,27);

TimeFrameSet( inHourly);
AH = RSI(23)>70;
BH = RSI(23)<30;
CH = RSI(23)<70 AND RSI(23)>30;
TimeFrameRestore();

ah = TimeFrameExpand(ah,inHourly);
bh = TimeFrameExpand(bh,inHourly);
ch = TimeFrameExpand(ch,inHourly);

hourly_rib_col = IIf(ah OR bh,4,27);

// if you switch to 5 min... all this will become of 5min...
A14MU = RSI(14)>50;
A14MD = RSI(14)<50;
A23MU = RSI(23)> 60 AND RSI(23) <70;
A23MD = RSI(23)> 30 AND RSI(23) <40;
A23N = RSI(23)> 39 AND RSI(23) <59;
A1 = RSI(23) < 30 OR RSI(23) > 70;

fifteen_rib_col = IIf(a14mu,27,IIf(a14md,4,IIf(a23mu OR a23md,3,IIf(a1,7,31))));

chartmax = HighestVisibleValue(H);
chartmin = LowestVisibleValue(L);
diff = chartmax-chartmin;

Plot(chartmin+diff*0.04,"",daily_rib_col,styleNoLabel,0,0,0,0,10);
Plot(chartmin+diff*0.08,"",hourly_rib_col,styleNoLabel,0,0,0,0,10);
Plot(chartmin+diff*0.12,"",fifteen_rib_col,styleNoLabel,0,0,0,0,10);
lowest ribbon is daily, then above it hourly, n above it current TF, that is, fifteen min...
 
Last edited:

Similar threads