Page 1 of 1

How to show a square

Posted: Thu May 16, 2024 10:55 am
by anon
I am a little rusty on my programming

How would I show a square for every occurance where close>close[1] and close[1]>close[2]

each time I try it only plots a square on the current close - not past occurances where the condition was met

thanks!

Re: How to show a square

Posted: Thu May 16, 2024 11:05 am
by Chris White
Here's a script that generates an event whenever the condition is true and then plots a square above the event bar:

Code: Select all

event:= C > REF(C,1) & REF(C, 1) > REF(C,2);

DRAWSHAPE(event,H, 1, false, -10 , 'SQUARE',1,'BLACK','MAGENTA');
and here's what that looks like on a chart:
showsquare.png
showsquare.png (52.78 KiB) Viewed 445558 times