Hi Darren,
I have two scripts that I want to use in a watchlist with a true/false statement. When I copy the script into the watchlist, it only shows 0s, which I can change using a custom label to display a true/false statement instead. How can I do this?
Mo
S1=GANNSWING(SWINGCOUNT=3, USEINSIDE=True);
V1 = MA(BARS=9, STYLE=Exponential) ;
V2 = MA(BARS=20, STYLE=Exponential) ;
V3=V1 CrossesAbove V2;
V4=S1 TurnsUp;
V5=SIGNALAFTER(V3,V4);
V5
S1=GANNSWING(SWINGCOUNT=3, USEINSIDE=True);
V1 = MA(BARS=9, STYLE=Exponential) ;
V2 = MA(BARS=20, STYLE=Exponential) ;
V3=V1 CrossesBelow V2;
V4=S1 TurnsDown ;
V5=SIGNALAFTER(V3,V4);
V5
Hi Mo,
In Boolean scripts, true results are given a value of 1, and 0 for false. Most true/false formulas label them automatically, but some are more complex and give the 0 and 1 values instead. You can either set the custom labels as per the image below, or change the last line of the script to make it a Boolean ie V5==1.
1 Like
Thank you. I changed V5 to 1 and set custom labels to True. Let’s see how it goes today. I noticed everything on the watch list is False right now.
Hi Darren, how can I make the True/False statement stay True or False after the signal?
What I noticed is that the signal triggers but then goes back to False on the next bar, unlike how the swing direction behaves.
On the 3-bar swing, the statement remains True until the swing turns down.
Mo
Hi Mo,
It’s because you are using the TurnsUp condition, so it only signals on the day the swing changes direction.
The SIGNALAFTER() function requires two Boolean conditions (ie the MA crossover followed by the change in swing direction). I can’t think of a quick way to keep the signal true, so maybe add another column with this to show current swing direction is up and EMA9>EMA20:
S1=GANNSWING(SWINGCOUNT=3, USEINSIDE=True);
V1 = MA(BARS=9, STYLE=Exponential) ;
V2 = MA(BARS=20, STYLE=Exponential) ;
V3=V1 > V2;
SWINGUP(S1) and V3
Note that the way your current formula works the signal will occur after the last MA crossover, even if it has crossed back below since (which is why SNA, PRU, etc are showing False in the 2nd column below).
1 Like
Thank you. I’ll give it a try tomorrow morning and see how it goes. I only use the 1-hour time frame with the 9 and 20 EMAs — no other time frame. On the daily chart, I use the 20, 50, and 200 EMAs.
Can you send me this workbook, please? I’ll change it to the 1-hour time frame and see how it goes.
Open the attached and change the watchlist and chart timeframe to 60 minutes.
Mo_Signals.owb (35.5 KB)
1 Like
Thanks. The 15-minute timeframe works much better with these MAs.
1 Like