I am trying to put together a script for a conditional order that will route an order when an option spread (in this case a strangle) marks at a certain price, but compute a moving average of he price for the last X minutes to eliminate random bad marks that will sometimes trigger alerts.
I put together a script (see below) and it works well when I set the Condition Setup at the top of the window to 1 day, but if I set it to 1 minute it doesn't return any results and won't trigger. My guess is it has something to do with me using "close" instead of something to see the mark of the options, but I don't know how to pull the mark of a specific option.
Can someone help me pull the mark of a specific option? Is there a better way to accomplish what I'm trying to do?
1Day settings: https://www.dropbox.com/s/aobgx5n15uph2k9/1day_condition_data.png?dl=0
1Min settings: https://www.dropbox.com/s/5by2bpv6yngecdk/1min_condition_nodata.png?dl=0
Thanks!
I put together a script (see below) and it works well when I set the Condition Setup at the top of the window to 1 day, but if I set it to 1 minute it doesn't return any results and won't trigger. My guess is it has something to do with me using "close" instead of something to see the mark of the options, but I don't know how to pull the mark of a specific option.
Can someone help me pull the mark of a specific option? Is there a better way to accomplish what I'm trying to do?
Code:
def period = AggregationPeriod.MIN;
def dura = 10;
input PutStrike = 220;
input CallStrike = 230;
input underlyingEXP = ".IWM211015";
plot avg = Average(close(concat(underlyingEXP, concat("C", concat(CallStrike, ""))))+close(concat(underlyingEXP, concat("P", concat(PutStrike, "")))),dura);
1Day settings: https://www.dropbox.com/s/aobgx5n15uph2k9/1day_condition_data.png?dl=0
1Min settings: https://www.dropbox.com/s/5by2bpv6yngecdk/1min_condition_nodata.png?dl=0
Thanks!