Please get it to work on second charts  [SOLVED]

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

Please get it to work on second charts

Postby pitrader » 18 Dec 2023

I have an indicator that works great on minute charts but it does not work on second charts. It either does not display or the trend line extension doesn't align with the 2 latest data points. Can someone please help me with this. Much appreciated!!

[ inputs: Displace( 5);

Variables: Price(0), Length( 5), NumATRs( .5);
Variables: Avg( 0 ), Shift( 0 ), LowerBand( 0 ), Pi2( 0 ) ,
TL(-1);
Price=(low );


AVG = AverageFC( Price, Length ) ;
Shift = NumATRs * AvgTrueRange( Length ) ;
Pi2 = Avg + Shift ;


if Displace >= 0 or CurrentBar > AbsValue( Displace ) then
begin

Plot1[Displace]( Pi2, "Pi#2" ) ;


Once TL=TL_New(Date,Time,0,Date,Time,0);

TL_SetEnd(TL,Date[Displace],Time[Displace],Plot1 [Displace] );
TL_SetBegin(TL,Date[Displace+1],Time[Displace+1],Plot1[Displace+1]);
TL_SetExtRight(TL,true) ;

TL_SetStyle(TL, tool_dotted);

TL_SetColor(TL,darkgreen);

end; ]

User avatar
BB123
Posts: 69
Joined: 24 Nov 2023
Has thanked: 23 times
Been thanked: 11 times

Re: Please get it to work on second charts  [SOLVED]

Postby BB123 » 18 Dec 2023

Hi PiTrader... So the problem is you need to add the _s suffix to break it down to seconds... Try this. Youll notice that i added the suffix to both tl new and tl sets as well as the time calls..

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]);

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

Re: Please get it to work on second charts

Postby pitrader » 19 Dec 2023

Thanks BB123 You're the best!!


Return to “MultiCharts”