AFL help timeframe expand

#1
Hello guys, i am having a little trouble with a very simple snippet.
i am trying to plot dynamic color on a MA from a different timeframe (4 hourly on a 15min chart)

when i plot the expanded MA i get red bits where it should only be white (ive highlighted them in pink in the attached picture.
in the same picture below it is the 4 hourly window of the same code un compressed and shows it all in white.

can anybody help?


the code is as follows


////////////////////////////////////////////////////4 hourly stuff///////
setstime = Param( "Timeset", 4, 1, 24 );
TimeFrameSet (setstime*inHourly);

WMAC4 = WMA( C, 15 );
WMAO4 = WMA( O, 15 );


WMAC14 = Ref(WMA( C, 15 ),-3);


Closeminprevclose4 = WMAc4-WMAC14;
Openminclose4 = WMAO4-WMAC4;
dynamic_color = IIf( Closeminprevclose4>Openminclose4 , colorWhite, colorRed );
Plot(TimeFrameExpand(Closeminprevclose4, setstime*inHourly),"Close - Prev2close", dynamic_color, styleThick, Null, Null, 0 );
Plot(TimeFrameExpand( Openminclose4, setstime*inHourly),"open - close", colorAqua, styleThick, Null, Null, 0 );
TimeFrameRestore();
///////////////////////////
 

Attachments

sikandar

Active Member
#2
Hello guys, i am having a little trouble with a very simple snippet.
i am trying to plot dynamic color on a MA from a different timeframe (4 hourly on a 15min chart)

when i plot the expanded MA i get red bits where it should only be white (ive highlighted them in pink in the attached picture.
in the same picture below it is the 4 hourly window of the same code un compressed and shows it all in white.

can anybody help?


the code is as follows


////////////////////////////////////////////////////4 hourly stuff///////
setstime = Param( "Timeset", 4, 1, 24 );
TimeFrameSet (setstime*inHourly);

WMAC4 = WMA( C, 15 );
WMAO4 = WMA( O, 15 );


WMAC14 = Ref(WMA( C, 15 ),-3);


Closeminprevclose4 = WMAc4-WMAC14;
Openminclose4 = WMAO4-WMAC4;
dynamic_color = IIf( Closeminprevclose4>Openminclose4 , colorWhite, colorRed );
TimeFrameRestore();

dynamic_color = TimeFrameExpand(dynamic_color,setstime*inHourly);
Plot(TimeFrameExpand(Closeminprevclose4, setstime*inHourly),"Close - Prev2close", dynamic_color, styleThick, Null, Null, 0 );
Plot(TimeFrameExpand( Openminclose4, setstime*inHourly),"open - close", colorAqua, styleThick, Null, Null, 0 );

///////////////////////////
try this which is modified in ur quote
 

Similar threads