Hi everyone,
The script below triggers when the stock price goes below the market open (9:30 a.m.) price for the current day and when the MACD Diff is negative. The script below triggers after the candle closes. Is there a way to adjust the script so that the script triggers as soon as the MACD Diff crosses below zero instead of waiting until after the candle closes? Thank you very much for your time and your help.
The script below triggers when the stock price goes below the market open (9:30 a.m.) price for the current day and when the MACD Diff is negative. The script below triggers after the candle closes. Is there a way to adjust the script so that the script triggers as soon as the MACD Diff crosses below zero instead of waiting until after the candle closes? Thank you very much for your time and your help.
Code:
input sell_percent_gain = 0.0;
input price1 = close;
input start = 0930;
def daystart = secondstillTime(start) == 0;
def dayopen = if daystart then open else dayopen[1];
def daydiff = round(price1 - dayopen,2);
def pergain = round(100*daydiff/dayopen,1);
def d = MACDHistogram().diff;
input trigger_on_all_prices_below_stop = yes;
def sell1 = if (daystart or trigger_on_all_prices_below_stop) and pergain <= sell_percent_gain and d < 0 then 1 else if d < 0 and pergain crosses below sell_percent_gain then 1 else 0;
plot z1 = sell1;


Last edited by a moderator: