Hello, I am looking to have labels that show as green or red when comparing current price to market open price.
1) The first issue that I am having is that the following works if I put each symbol in a script by itself:
However, when I put the three of them together in one script it returns error, "Two different secondary periods cannot be used within a single variable."
2) The second issue is that for futures (/ES, /VX, etc.) I don't know if
is correct due to their trading hours. How would I define the opening time as 09:30am EST?
3) Lastly, how would I modify the script to show red/green based on the close of the previous 5 minute candle?
I have searched the forums and and tried a number of different snippets but can't seem to get it working correctly.
Thank you!
1) The first issue that I am having is that the following works if I put each symbol in a script by itself:
Code:
## SPX Badge
def spxCurrentPrice = close (symbol = "SPX");
def spxOpenPrice = open (symbol = "SPX", period = AggregationPeriod.DAY);
AddLabel(yes, Concat (”SPX: ", spxCurrentPrice), if spxCurrentPrice > spxOpenPrice then Color.GREEN else Color.RED);
## VIX Badge
def vixCurrentPrice = close (symbol = "VIX");
def vixOpenPrice = open (symbol = "VIX", period = AggregationPeriod.DAY);
AddLabel(yes, Concat (”VIX: ", vixCurrentPrice), if vixCurrentPrice > vixOpenPrice then Color.RED else Color.GREEN);
## /VX Badge
def vxCurrentPrice = close (symbol = "/VX");
def vxOpenPrice = open (symbol = "/VX", period = AggregationPeriod.DAY);
AddLabel(yes, Concat (”/VX: ", vxCurrentPrice), if vxCurrentPrice > vxOpenPrice then Color.RED else Color.GREEN);
However, when I put the three of them together in one script it returns error, "Two different secondary periods cannot be used within a single variable."
2) The second issue is that for futures (/ES, /VX, etc.) I don't know if
Code:
period = AggregationPeriod.DAY
3) Lastly, how would I modify the script to show red/green based on the close of the previous 5 minute candle?
I have searched the forums and and tried a number of different snippets but can't seem to get it working correctly.
Thank you!
Last edited: