Function from Startegy and Signal

Questions about MultiCharts .NET and user contributed studies.
User avatar
tito0224
Posts: 15
Joined: 01 May 2013
Has thanked: 2 times
Been thanked: 6 times

Function from Startegy and Signal

Postby tito0224 » 05 Jun 2013

Hi,

I am using the same function from an indicator and a signal. It is working as expected from the Indicator, however it is not always returning the correct values when being used in a signal.

I thought it was related to having IOG turned on in the signal but I have having the same problem even when I turn it off.

Any ideas as to why the same function would return different results?

Thanks

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: Function from Startegy and Signal

Postby MidKnight » 05 Jun 2013

Do they both have 'update on every tick' checked/unchecked on the properties tab?

With kind regards,
MK

User avatar
tito0224
Posts: 15
Joined: 01 May 2013
Has thanked: 2 times
Been thanked: 6 times

Re: Function from Startegy and Signal

Postby tito0224 » 05 Jun 2013

I know how to select update on every tick for the Indicator- but I do not see any option for this for the strategy (if you mean use Bar Magnifier then I have tried with and without it and it is behaving the same.....

but I have my code wrapped in:

Code: Select all

if (Bars.Status == EBarState.Close)
{
...
}

But it seems to enter this block multiple times on the same Bar Number when being called from the Strategy but not when it is called from the indicator.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Function from Startegy and Signal

Postby Henry MultiСharts » 06 Jun 2013

On historical data indicator is calculated on bar close values only. There are multiple historical data calculation modes for the signal. In order indicator and signal historical calculations to match IOG and Bar Magnifier should be disabled for the signal.
If the signal is calculated tick by tick, i.e. IOG is enabled for the signal, the Update on every tick feature should be enabled for the indicator in order to make the realtime calculations match.
There is a dedicated article for this topic: How to make indicator and signal calculation results the same

HenryYang
Posts: 2
Joined: 17 Jun 2013

Re: Function from Startegy and Signal

Postby HenryYang » 17 Jun 2013

After I follow the instruction in the link, I'm still getting the same error. Is there anything else that I can check?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Function from Startegy and Signal

Postby Henry MultiСharts » 18 Jun 2013

Hello HenryYang,

Please elaborate. Attach the workspace and studies you are using. Describe your case in details and highlight the discrepancy on the screenshots.

HenryYang
Posts: 2
Joined: 17 Jun 2013

Re: Function from Startegy and Signal

Postby HenryYang » 18 Jun 2013

Here's the workspace, studies. I ran them on 1 month worth of data and write their value to a file. You can see that their values are clearly different.
Attachments
DMI2 repro.zip
workspace, indicator and signal code and their output
(29.97 KiB) Downloaded 552 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Function from Startegy and Signal

Postby Henry MultiСharts » 19 Jun 2013

HenryYang, your indicator max bars back is 150 while your signal max bars back is 50. That is the source of the difference. Please check the article How to make indicator and signal calculation results the same to learn how to set the same max bars back value and have the same calculation results.


Return to “MultiCharts .NET”