I was wondering if anyone has seen the following ever happen.
I'm trading ES on a five minute bar with IOG = True. One of my conditional statements for entry is based on a lower bollinger band, called var42. If "close < var42" then one of the conditional statements is met for entry.
I was running my signal live though not connected to a broker profile, so all generated signals were within my WS and purely for me to evaluate.
The 915 bar closes and var42 is 2047.75 and the close was 2047.00. The very next tick forms the 920 bar and the close is 2047.00 and var42 is 2046.21 so the conditional statement "close < var42" is not true, but a trade still generates.
What seems to have happened is the script calculation used the close that first formed the 920 bar, but the prior var42 value which was from the 915 bar.
I calculate var42 at one of the earliest lines of my script, well before the conditional statements are written and I do not reference close on prior tick at all in my script.
It seems to be some weird, one off type of thing. Maybe there was an unfiltered tick or something that I'm not seeing in my data (DTN) who knows. I was curious if anyone has ever seen anything like this before. The rest of the trades I've evaluated are working as they should. Just this one that is a bit whacky. I've printed my values to make sure they are correct, and they are.
Script Calculation [SOLVED]
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Script Calculation
With IOG=true, the strategy is calculated every tick, not at EOB.I was wondering if anyone has seen the following ever happen.
I'm trading ES on a five minute bar with IOG = True. One of my conditional statements for entry is based on a lower bollinger band, called var42. If "close < var42" then one of the conditional statements is met for entry.
I was running my signal live though not connected to a broker profile, so all generated signals were within my WS and purely for me to evaluate.
The 915 bar closes and var42 is 2047.75 and the close was 2047.00. The very next tick forms the 920 bar and the close is 2047.00 and var42 is 2046.21 so the conditional statement "close < var42" is not true, but a trade still generates.
What seems to have happened is the script calculation used the close that first formed the 920 bar, but the prior var42 value which was from the 915 bar.
I calculate var42 at one of the earliest lines of my script, well before the conditional statements are written and I do not reference close on prior tick at all in my script.
It seems to be some weird, one off type of thing. Maybe there was an unfiltered tick or something that I'm not seeing in my data (DTN) who knows. I was curious if anyone has ever seen anything like this before. The rest of the trades I've evaluated are working as they should. Just this one that is a bit whacky. I've printed my values to make sure they are correct, and they are.
I am not sure if I follow your problem.
Re: Script Calculation
It looks like on this one generated signal, that the script used the close, which was the bar that formed the new bar but did not use the new var42 for the new bar but rather the prior var42 from the bar that had just closed.
As if I was referencing var42[1], but I was not. It very well could have been a tick in my data feed that I didn't even see and yet caused this to happen.
As if I was referencing var42[1], but I was not. It very well could have been a tick in my data feed that I didn't even see and yet caused this to happen.
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Script Calculation
Computers are dumb, it can only do things you instruct it to do.It looks like on this one generated signal, that the script used the close, which was the bar that formed the new bar but did not use the new var42 for the new bar but rather the prior var42 from the bar that had just closed.
As if I was referencing var42[1], but I was not. It very well could have been a tick in my data feed that I didn't even see and yet caused this to happen.
And it does things in sequence. ie. if you asked it to calculate the moving average, it will, and that's the number it will have. Unlike your gf, it has no emotion to go back to the previous bar, or the previous tick, to mix up the calculations or the results.
There must be something amiss in your code.
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Script Calculation
What are your Bollinger Bands parameters?::
The 915 bar closes and var42 is 2047.75 and the close was 2047.00. The very next tick forms the 920 bar and the close is 2047.00 and var42 is 2046.21 so the conditional statement "close < var42" is not true, but a trade still generates.
::
If the previous tick was 2047, and the next tick is also 2047,
I doubt you can move the lower band by more than a few decimals, let alone 1.54. (2047.75-2046.21=1.54)
Have you done a manual recalculation tick by tick?
Re: Script Calculation
It's a short MA so the bands move quickly. I printed out the value of the variable and it matches with what I have on my chart. At this point I'm thinking there was a rogue tick in my data that caused this to happen. I've been running this type of script for over a year and never saw anything like this. I checked a number of other trades over a given period of time in replay mode and the script is working as it was intended. Thanks for sharing some thoughts on this.
Re: Script Calculation [SOLVED]
In case someone googles this question years from now I wanted to post follow up after MultiCharts helped me out.
I have "allow one entry per bar" checked for my signal. What was happening is for example on the 905 bar my script would generate a signal and during the 905 bar would exit for a win. Now on the very last tick of the 905 bar, the close was such that conditions were met generating a new entry. But it can't take the trade on the 905 bar because it already executed the max allowable trade of 1. But the next tick would be on the first print of the 910 bar, where it could trade.
What was confusing me, is the conditions were met to generate a trade but were on the same bar that a trade already was generated. BUT, it was the last print of that bar. The actual trade would execute on the 910 bar.
I have "allow one entry per bar" checked for my signal. What was happening is for example on the 905 bar my script would generate a signal and during the 905 bar would exit for a win. Now on the very last tick of the 905 bar, the close was such that conditions were met generating a new entry. But it can't take the trade on the 905 bar because it already executed the max allowable trade of 1. But the next tick would be on the first print of the 910 bar, where it could trade.
What was confusing me, is the conditions were met to generate a trade but were on the same bar that a trade already was generated. BUT, it was the last print of that bar. The actual trade would execute on the 910 bar.