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)
First, I managed to reproduce your problem, on the same chart (AAPL 1min July 26th, 2012).
From @Jura's post above, I understand that, when [IntrabarOrderGeneration = true], "at next bar" means "at next tick".
So the strategy was entering "at next bar" (in the common sense) only if the first tick of the next bar was above the High of the current one.
But you want to enter at any tick within "next bar" provided that this tick is above the High of the current one.
So you have to use @Jura's idea.
I have integrated it into our small code. See below. It seems to work. See picture.
"at High stop" is correct when the above 3-line block of code is read on the last tick of the current bar.
But if these lines are read at a tick within the next bar (supposed to be the entry bar), should be "at High[1] stop".
Yes that is correct. It works now... You are correct that we need to store the PriceForEntry in a variable.... Thanks so much!
Because I would like to make sophisticated stops, it would be good to use a lower time frame chart, but use a higher time frame data for entries.
Yesterday I spoke of creating a high and a low for the complete hour and drawing a trendline on the chart for each next hour.. So if during 10am to 11am the highest tick was 610.20 and the lowest tick was 605.80 then we would have horizontal trendlines from 11am to 12am at 610.20 and 605.80. This would be a visual cue , but in fact the strategy would enter a trade long if it price broke above 610.20 and would enter short if it broke below 605.80. Then I can use the smaller time frame bars in the chart to manage the exit (do a trailing stop if i am in a long trade and it breaks the highest low of the last 2 bars or something).
Actually the existing strategy would look at the trendlines of the last 2 hours, to see if trendlines are higher high and lower low, and then if so , if the next hour breaks the high it enters long...
If you have time to code something like that, I would really appreciate it.
1. You're welcome, but your thanks shall also be directed to @Jura: he solved the most difficult part.
2. Even if it is possible, I think that there is no need to use 2 timeframes to manage your strategy. With [intrabarordergeneration = true], you can manage what happens at all ticks in the bar.
3. "the strategy would enter a trade long if it price broke above 610.20 and would enter short if it broke below 605.80"
Do you mean that the strategy would enter long at any bar on a breakout (up) of last bar's High?
If yes, you can very easily adapt the above code. I do not see the problem.
9am to 10am Highest high was 505.20 Lowest Low was 502.30
10am to 11am Highest high was 506.20 Lowest Low was 503.50
Therefore, if we were in hourly chart we would see that the last bar offered a higher high and a higher low.
So if during the next hour, price rose above 503.20 we would enter long.
The reason why I would like to have lower time frame bars is because by looking at how bars are painted I can do more sophisticated stops. For example if i had 300 shares long, after it hit target 1, then i can implement an trailing stop where I would look at the last 3 five minute bars and if price fell below the lowest low of the last 3 bars then it would stop me out of the trade.
Therefore, I use the hourly highest high and lowest lows to determine if the trade is qualified to go long, and at what price, then I can use a lower time frame bar (for example, 5 minute bars) to implement a more agile and sophisticated stop strategy.
Since we are using a 10 minute chart, it would look at the 6 bars from 9am to 10am and look for the highest and lowest price that the bars touched during that time.
9:10 Bar: High=500.10 Low = 500.00
9:20 Bar: High=500.50 Low = 498.10
9:30 Bar: High=502.10 Low = 500.10
9:40 Bar: High=501.10 Low = 499.22
9:50 Bar: High=505.20 Low = 500.20
10:00 Bar: High=505.20 Low = 501.20
The highest high = 505.20 and the Lowest low is 498.10 for the hour.
so then we would draw two horizontal trendlines (one at 505.20 and one at 498.10) that would span into the future from 10:10 to 11:00