I would like to add an External Symbol value as an additional condition in a trading strategy. First, I am trying to plot the series, but it gives me the Primary Symbol plot in the new pane instead of the External Symbol. Here is the code:
CODE:
Please log in to see this code.
Once this is working I want to use the daily External Symbol value as part of trading rule. Would I do this like this?
CODE:
Please log in to see this code.
Do I need to use ChangeContext( ) anywhere if I only want to trade the Primary Symbol, not the External Symbol?
Size:
Color:
1 -
CODE:
Please log in to see this code.
2 - No, you don't have to use Set/RestoreContext.
Size:
Color:
I had that previously, but it generates the following error:
QUOTE:
Run time error. Object reference not set to an instance of an object.
Size:
Color:
Look, you can not have it other than "vix.Close" if you want to plot the secondary symbol's series. Having a runtime error is not a good reason to break the correct syntax.
Ideas to try:
1) Use Synchronize()
2) Call GetExternalSymbol() without
dataSetName3) More troubleshooting suggestions in the Wiki >
Errors | Strategy >
Object reference not set to an instance of an object
Size:
Color:
I pursued idea #3 and figured out my DataSetName variable had an incorrect capitalization the name. That was causing it.
Thanks.
Size:
Color: