MA Extension

Questions about MultiCharts and user contributed studies.
pitrader
Posts: 26
Joined: 20 Apr 2022
Has thanked: 1 time
Been thanked: 1 time

MA Extension

Postby pitrader » 23 Dec 2023

I have a MA that I would like to extend into the future connecting the last 2 data points on second charts. I have the code below. Some of which was written by BB123 when he helped me with adapting it to a Keltner channel on second charts. This is just a simple MA. The code compiles but does not display. Any help would be appreciated.

Code: Select all

inputs: Price( Close ), Length( 9 ), Displace( 0 ) ; variables: var0( 0 ) ; Variables: TL(-1); var0 = AverageFC( Price, Length ) ; condition1 = Displace >= 0 or CurrentBar > AbsValue( Displace ) ; if condition1 then begin Plot1[Displace]( var0, "Avg" ) ; if Displace <= 0 then begin condition1 = Price crosses over var0 ; if condition1 then Alert( "Price crossing over average" ) else begin condition1 = Price crosses under var0 ; if condition1 then Alert( "Price crossing under average" ) ; Once TL=TL_New_s(Date,Time_s,0,Date,Time_s,0); TL_SetEnd_s(TL,Date[Displace],Time_s[Displace],Plot1 [Displace] ); TL_SetBegin_S(TL,Date[Displace+1],Time_s[Displace+1],Plot1[Displace+1]); TL_SetExtRight(TL,true) ; TL_SetStyle(TL, tool_dotted); TL_SetColor(TL,darkgreen); end; end ; end; [code]
Last edited by pitrader on 24 Dec 2023, edited 1 time in total.

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: MA Extension

Postby TJ » 24 Dec 2023

See post #1 & #2
viewtopic.php?t=11713

pitrader
Posts: 26
Joined: 20 Apr 2022
Has thanked: 1 time
Been thanked: 1 time

Re: MA Extension

Postby pitrader » 24 Dec 2023

Hey guys. I just figured it out for myself. Thanks for all of your contributions on my other posts!! It is much appreciated.


Return to “MultiCharts”