I'm trying to develop a variant of the ratio indicator (attached). The modifications I need are for it to be able to:
1. Enter my own multiples for each security so the baseline is 1 initially, and the ratio deviates from this amount. For example, if SPY is $200 and QQQ is $100, I want to be able to assign a multiple of 2 to QQQ so the initial ratio is 1. I know how to do this.
2. However, I also want the multiple to be recalculated and the ratio reset every EOD. To achieve this, within the OnBarUpdate() function, I'd like to have a "If New Day... Then... Recalculate The Multiplier" using yesterday's closes for both securities.
Would an if(Bars.FirstBarofSession) work here?
3. Where I'm really stuck though is in getting the previous closes for both securities. I'm new to NT and have no clue how to deal with two securities in one script. If it was just one security, I guess this could be done:
lastclose1 = Bars.GetDayBar(1).Close
How would I get the closing price of the second security though?
Any help will be much appreciated. Thanks in advance!
Comment