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)
What it would do is create a high and a low horizontal trendline for the next hour... and it would keep doing that moving forward
so each prior rounder prior hour would have a high and a low price, and then it would create a trend line for the next hour's worth of bars so u can see if it is breaking the high or the low of the prior hour.. That way I would have the power of using hour bars to determine entry prices and i can use 1 minute bars to determine exit strategy.
Can you help answer these questions from other members on NexusFi?
1. The 1-min workaround is another story. I think that we first need to solve what happens with the 1-hour bar.
2. "I cant decipher the time". I do not understand. Could you show me an example of what is printed?
On my side, it is rather clear:
3. "Is it possible to put the # of shares held Below the bar itself?"
Yes.
EDIT: This works for MultiCharts. I do not know for TradeStation.
4. "I need the " BarStatus(1) = 2" because I want to enter on the next bar on the break of the prior bar high..."
I am lost.
In the first message, I have the feeling that you wanted exactly the contrary: enter within a bar.
If you want to enter right at the opening of the next bar when a condition is met, you shall not use [intrabarordergeneration = true]
Please clarify.
3) ok i put that in the code, and i have enclosed screenshot
4) i want to enter in the next bar, once it breaks the high of the prior bar , but I want to be able to exit if my target is met on the same bar that I entered....
For the date, do not forget that 112 means 2012 in Easy Language (add 1900).
The text printing on the chart is OK. We see the "0". When the trade lasts on several bars, you should see 300, 200, 100. If you want to change the color or the size:
If I have correctly understood what you are trying to do, this is not straight-forward.
I have myself struggled with it for a long time.
So thanks for your question, since it allows me clarifying things in my mind.
But the negative side is... I may be wrong!
You want the exits (stop-loss or profit target) to possibly occur on the same bar as the entry.
I think this requires [intrabarordergeneration = true].
But [IntrabarOrderGeneration = true] has a negative side effect: the condition for the entry is checked at any moment within the current bar. But you want the condition to be checked only at bar close. So there is your BarStatus = 2.
So... I'm OK with your code.
It remains that you have some problem.
I advise that you simplify your code to the simplest. For me, the simplest form is 10 lines:
Does it work? If yes, add the sophistications one by one until the problem appears.
If one uses BarStatus = 2 with 'buy next bar', the order will be executed on the first tick of the next bar (assuming it's a market order, otherwise it will be cancelled). With IntrabarOrderGeneration set on, the stop-loss for the same bar can be send on the second tick of the bar.
I can't say I understand the whole thread, but if I understand it correctly the enter stop orders need to be submitted for the whole duration of the next bar? If so, you'll need to use a true/false value to keep continue submitting the stop order for the next bar.
Because with IntrabarOrderGeneration next bar actually means next tick, the enter stop needs to be resubmitted. Otherwise, if the enter stop conditions aren't triggered on the first tick of the next bar, the order is cancelled.
I implemented the code you are suggesting.. I agree its a good idea to make it as simple as possible to figure out the problem.
Here is the chart with circled red where it should have entered on the bars with red underlines in the circle, code is below also...
I am showing with 5 min bar charts and 60 Min bar chart
5 MIN BARS
60 MIN BARS
I used 1 dollar hardcoded for entrypice and exit price, since i am trading aapl.
variables:
TickSize (MinMove/PriceScale);
[IntrabarOrderGeneration = true]
// open new positions
if (MarketPosition = 0 and barstatus(1) = 2 and Low >= Low[1] and High >= High[1]) then begin
Buy ("Enter Long") 300 Shares Next Bar At high stop;
end;
Value1 = Text_New(Date, Time, Low-TickSize, NumToStr(CurrentShares, 0));
// manage open orders
if MarketPosition = 1 then begin
Sell("Profit Target") 300 Shares Next Bar at (EntryPrice + 1) Limit;
Sell("Stop Loss") 300 Shares Next Bar at (EntryPrice-1) Stop;
end;