Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have a strategy on Data1 (15M chart) with a simple moving average filter using Data2 (daily chart). Long trades are only taken when above the 100-day MA and short trades only when it is below.
The strange thing is that I get different (better) results when using the close of data2 instead of the normal close (of data1).
Below is some code to clarify what I mean:
*Value2 being the value of the moving average
Shouldn't the results be the same? Is the 2nd code looking into the future?
Thanks for your help!
Can you help answer these questions from other members on NexusFi?
I don't think I follow you: if Data1 is a 15-minute chart and Data2 is a daily chart, isn't it to be expected that `Close` (of data 1) gives a different value than `Close of Data2`?
Only once per day is `Close` the same as `Close of data2`, and that's when the 15-minute bar is the last bar of the day. But for all other bars I'd say it's normal to have a difference between them. Or do you use intra-bar order generation and the Bar Magnifier feature?
Close Data2 is likely the last closed bar on your chart (yesterday) where Close is the last closed bar on the 15 minute chart. This is assuming the absence of intrabar order generation.
Therefore the results can and will be different, like @Jura pointed out, too. One good way of checking things and seeing the difference can be using the Print command and the output window to show the actual values for Close, Close Data2 and Value2.
On a side note I'd suggest to start using meaningful variable names as this can help you in the future. With variables you declare you can actually tie them to certain datastreams, which you can't do with Value2.
Regards,
ABCTG
kristian
I have a strategy on Data1 (15M chart) with a simple moving average filter using Data2 (daily chart). Long trades are only taken when above the 100-day MA and short trades only when it is below.
The strange thing is that I get different (better) results when using the close of data2 instead of the normal close (of data1).
Below is some code to clarify what I mean:
Condition7 = Close > Value2; // Profit Factor 1.53
Condition7 = Close of Data2 > Value2; // Profit Factor 2
*Value2 being the value of the moving average
Shouldn't the results be the same? Is the 2nd code looking into the future?
I thought that the Close of the daily bar would be the same as the 15M bar because (intrabar og turned off) they move in sync. I assumed that the script gets calculated on every tick and that Close referred to the current close of the bar (even if it's not closed yet).
So if I understand you guys right this is only true with intra bar order generation turned on? And otherwise the script is only calculated on every new bar hence the Close values will be different?
@ABCTG Thanks for the print suggestion, I should have tried that before! Also would you mind clarifying what you mean by "you can actually tie them to certain datastreams"
When you tie a variable to a datastream you specify when it will be updated i.e. in line with this datastream. If you don't do that, the variable will updated whenever the Data1 variables are update.
I thought that the Close of the daily bar would be the same as the 15M bar because (intrabar og turned off) they move in sync. I assumed that the script gets calculated on every tick and that Close referred to the current close of the bar (even if it's not closed yet).
So if I understand you guys right this is only true with intra bar order generation turned on? And otherwise the script is only calculated on every new bar hence the Close values will be different?
@ABCTG Thanks for the print suggestion, I should have tried that before! Also would you mind clarifying what you mean by "you can actually tie them to certain datastreams"