Set Alert To Trigger Upon Close


0
0

Hello, Currently I use a Custom Condition Wizard Study (for an MA crossover) combined with the built in Price Change Study for a Custom Scan. It searches for a displaced MA Crossover to occur first (either 0 bars or 1 bar ago) then lets me know when the current bar is .05% greater than the close of the prior bar.

I then use the “Alert When Scan Results Change” to send me text alerts. It works fine. But I would like  to have it send the alerts when the current bar has closed completely. I used the Search to look at other solutions and it seems [1] is necessary but  that seems to be for custom alerts that have to be added to custom code. Since I built this scan with  the wizard and the built in Price Change study. I have no clue how to write it where this would just be all one big custom study with a custom alert that sends when the bar closes.

Code is in the text file.

Attachments:
RESOLVED
Marked as spam
Posted by (Questions: 2, Answers: 0)
Asked on August 30, 2020 10:58 am
37 views
1
Private answer

If I understand your request correctly, this should do the trick:

def signal = SimpleMovingAvg("length" = 2)."SMA" crosses above SimpleMovingAvg("length" = 3, "displace" = -2)."SMA" or SimpleMovingAvg("length" = 2)."SMA" from 1 bars ago crosses above SimpleMovingAvg("length" = 3, "displace" = -2)."SMA" from 1 bars ago;
plot triggerOnClose = signal[1];

Marked as spam
Posted by (Questions: 38, Answers: 3349)
Answered on August 30, 2020 11:54 am