a1cturner
Well-known member
Does order matter when defining studies? Does timeframe matter? For example: def MACD = if MACDDiff1Min > 0 and MACDDiff10Min > 0 then 1 else 0; Does it matter if I put all my 1 minute studies before the 10 minute studies etc? Does the type of study matter? For Example: def Study = if 5EMA > 12 EMA and MACDDiff > 0 and RSI > 70 then 1 else 0; Do certain types of studies need to go first?
I'm sure this sounds like a dumb question but I am working on a study and everything works great except one parameter. I am trying to paint the candles green if I get a "buy signal" but only if VIX EMA is Bearish and vice versa to paint them red if I get a sell signal and VIX EMA is bullish. I still want to see the buy and sell signals but want to be aware if VIX is trending in the wrong direction so I want to paint those candles orange if I get a buy signal and VIX is trending up and vice versa if I get a sell signal and VIX is trending down.
The VIX comparison works perfect by itself but is not working when I pair it with the other indicators.
Before you ask, yes I am aware of repainting.
This is what I have. I get the green, red, cyan, and grey candles but never an orange candle.
FYI the only 1 minute indicator is the TSIShort in the study below.
I'm sure this sounds like a dumb question but I am working on a study and everything works great except one parameter. I am trying to paint the candles green if I get a "buy signal" but only if VIX EMA is Bearish and vice versa to paint them red if I get a sell signal and VIX EMA is bullish. I still want to see the buy and sell signals but want to be aware if VIX is trending in the wrong direction so I want to paint those candles orange if I get a buy signal and VIX is trending up and vice versa if I get a sell signal and VIX is trending down.
The VIX comparison works perfect by itself but is not working when I pair it with the other indicators.
Before you ask, yes I am aware of repainting.
This is what I have. I get the green, red, cyan, and grey candles but never an orange candle.
FYI the only 1 minute indicator is the TSIShort in the study below.
Code:
#BUY CALL and PUT
def BuyCallTimeRest = StartDay and EndSignal;
def BuyCall1Min = TSIShort>0;
def BuyCall10Min = EMA1>EMA2 and EMA3>EMA4 and MACDDiff>=MACDDiff[1];
def BuyCall = BuyCallTimeRest and BuyCall1Min and BuyCall10Min and CompareEMA1<CompareEMA2;
def BuyPutTimeRest = StartDay and EndSignal;
def BuyPut1Min = TSIShort<0;
def BuyPut10Min = EMA1<EMA2 and EMA3<EMA4 and MACDDiff<=MACDDiff[1];
def BuyPut = BuyPutTimeRest and BuyPut1Min and BuyPut10Min and CompareEMA1>CompareEMA2;
#BUY CALL and PUT
def BuyCallXTimeRest = StartDay and EndSignal;
def BuyCallX1Min = TSIShort>0;
def BuyCallX10Min = EMA1>EMA2 and EMA3>EMA4 and MACDDiff>=0 and CompareEMA1>CompareEMA2;
def BuyCallX = BuyCallTimeRest and BuyCall1Min and BuyCall10Min;
def BuyPutXTimeRest = StartDay and EndSignal;
def BuyPutX1Min = TSIShort<0;
def BuyPutX10Min = EMA1<EMA2 and EMA3<EMA4 and MACDDiff<=0 and CompareEMA1<CompareEMA2;
def BuyPutX = BuyPutTimeRest and BuyPut1Min and BuyPut10Min;
#SELL CALL AND PUT
def SellCallTimeRest = StartDay and EndStop;
def SellCall1Min = TSIShort crosses below 0;
def SellCall10Min = MACDDiff crosses below MACDDiff[1];
def SellCall = SellCallTimeRest and SellCall1Min or SellCall10Min;
def SellPutTimeRest = StartDay and EndStop;
def SellPut1Min = TSIShort crosses above 0;
def SellPut10Min = MACDDiff crosses below MACDDiff[1];
def SellPut = SellPutTimeRest and SellPut1Min or SellPut10Min;
AssignPriceColor(if BuyCall then color.dark_green else if BuyCallX then color.orange else if BuyPut then color.dark_red else if BuyPutX then color.orange else if SellPut or SellCall then color.cyan else color.gray);
Last edited: