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
Function from Startegy and Signal
Re: Function from Startegy and Signal
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:
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.
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.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Function from Startegy and Signal
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
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
Re: Function from Startegy and Signal
After I follow the instruction in the link, I'm still getting the same error. Is there anything else that I can check?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Function from Startegy and Signal
Hello HenryYang,
Please elaborate. Attach the workspace and studies you are using. Describe your case in details and highlight the discrepancy on the screenshots.
Please elaborate. Attach the workspace and studies you are using. Describe your case in details and highlight the discrepancy on the screenshots.
Re: Function from Startegy and Signal
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 559 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Function from Startegy and Signal
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.