custom fututes, rollover code and alert questions  [SOLVED]

Questions about MultiCharts and user contributed studies.
rbn60604@yahoo.com
Posts: 24
Joined: 13 Mar 2012
Has thanked: 11 times

custom fututes, rollover code and alert questions

Postby rbn60604@yahoo.com » 02 Sep 2012

question #1,

I have created custom futures for most products but the currencies (in this case Canadian dollar) don't seem to be listed in the custom futures root symbol list (IB = data provider). I can add the required months to the symbol list but when you go to 'add custom future', there's no root symbol for Canadian dollar listed, anyone know why?

question #2,

OK, so I have a custom future, lets say Corn....I want to build a strategy that tells me whether the current front month contract has made a new 'contract high/low', so if December Corn is the front month, has it made a contract high/low SINCE ROLLOVER?, I know I could just ad the symbol without the custom future but it kind of defeats the purpose in my opinion. The reason this is important is because its a new crop, its not like ES where it doesnt matter, Rollover really is a new product in something like corn, and can have a dramatic price difference. I set rollover to No Adjustment, but that doesnt solve the problem....any help would be great.

question #3,

I have a strategy that 'alerts' when the condition is true, in the alert I include the close of a previous day....lets say close[30]....when the pop up/email appears, that close[30] only has two decimal places, so going back to the currencies, its a problem. The currencies all use 4 decimal places, so instead of getting 'sell Canadian dollar @ 1.0143'....it comes up as sell @ 1.01....might not seem like a big deal but it is.....I have the default decimals set to 5 in the strategy, the price that automatically comes with any alert has the 4 decimals, just not my text with the close[30].

Thanks for any input.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: custom fututes, rollover code and alert questions

Postby TJ » 02 Sep 2012

question #1,
...

question #2,

OK, so I have a custom future, lets say Corn....I want to build a strategy that tells me whether the current front month contract has made a new 'contract high/low', so if December Corn is the front month, has it made a contract high/low SINCE ROLLOVER?, I know I could just ad the symbol without the custom future but it kind of defeats the purpose in my opinion. The reason this is important is because its a new crop, its not like ES where it doesnt matter, Rollover really is a new product in something like corn, and can have a dramatic price difference. I set rollover to No Adjustment, but that doesnt solve the problem....any help would be great.
...

Thanks for any input.
if the focus of your data is on a specific contract, then don't use custom futures. Add the individual contracts to the wsp, either as a new chart, or as a data2 in the same chart. Afterall, memory is cheap and computing power is plentiful; it is the simpler solution.

rbn60604@yahoo.com
Posts: 24
Joined: 13 Mar 2012
Has thanked: 11 times

Re: custom fututes, rollover code and alert questions

Postby rbn60604@yahoo.com » 02 Sep 2012

I see your point but when I think about it, my initial question wasn't accurate, adding the individual contract doesn't actually solve the problem. What I'm really trying to get to is....how can I alert on a contract high/low since rollover?....so it's actually not the contract high/low....its the contract high/low from a specific date or event (volume/open int rollover), however the user defines rollover.

Maybe there's not an solution but are there any commands or code that identifies when rollover happens that I could put into a strategy....if rollover=true then barsback = to bar number - rollover bar number....type thing?...I know that's not real code there but just for question purposes.

Thanks for the help.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: custom fututes, rollover code and alert questions

Postby TJ » 02 Sep 2012

....if rollover=true then barsback = to bar number - rollover bar number....type thing?...I know that's not real code there but just for question purposes.

Thanks for the help.
a side note:

Actually that is the proper way to "code".
... first, think out loud in pseudo code,
then step-by-step modify the idea into workable logic,
then insert correct syntax and make it into executable scripts.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: custom fututes, rollover code and alert questions  [SOLVED]

Postby TJ » 02 Sep 2012

...
question #3,

I have a strategy that 'alerts' when the condition is true, in the alert I include the close of a previous day....lets say close[30]....when the pop up/email appears, that close[30] only has two decimal places, so going back to the currencies, its a problem. The currencies all use 4 decimal places, so instead of getting 'sell Canadian dollar @ 1.0143'....it comes up as sell @ 1.01....might not seem like a big deal but it is.....I have the default decimals set to 5 in the strategy, the price that automatically comes with any alert has the 4 decimals, just not my text with the close[30].

Thanks for any input.

if you are doing a text conversion:

Code: Select all

TEXT( CLOSE:0:4 );
:0:4 refers to 4 digits after the decimal point.

rbn60604@yahoo.com
Posts: 24
Joined: 13 Mar 2012
Has thanked: 11 times

Re: custom fututes, rollover code and alert questions

Postby rbn60604@yahoo.com » 03 Sep 2012

Thank you.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: custom fututes, rollover code and alert questions

Postby TJ » 03 Sep 2012

question #1,

I have created custom futures for most products but the currencies (in this case Canadian dollar) don't seem to be listed in the custom futures root symbol list (IB = data provider). I can add the required months to the symbol list but when you go to 'add custom future', there's no root symbol for Canadian dollar listed, anyone know why?

...
Thanks for any input.
Not sure why such a popular symbol is not in the roots dictionary.

You can manually add the symbol root to the list.
In Quote manager please go to the Tools tab-> Symbol dictionary-> Select the data source-> Add.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: custom fututes, rollover code and alert questions

Postby TJ » 03 Sep 2012

I see your point but when I think about it, my initial question wasn't accurate, adding the individual contract doesn't actually solve the problem. What I'm really trying to get to is....how can I alert on a contract high/low since rollover?....so it's actually not the contract high/low....its the contract high/low from a specific date or event (volume/open int rollover), however the user defines rollover.

Maybe there's not an solution but are there any commands or code that identifies when rollover happens that I could put into a strategy....if rollover=true then barsback = to bar number - rollover bar number....type thing?...I know that's not real code there but just for question purposes.

Thanks for the help.
Add a counter... and start counting at a specific point.


The Wiki is a useful resource.
Pay attention to the ExpirationDate keyword, and those under the Symbol section.
https://www.multicharts.com/trading-sof ... on/General


Return to “MultiCharts”