Hi guys,
I need to know how to buy say 8 ticks from the open?
The problem is that if i use a 1min chart, the calculation seems to happen after the chart is closed.
So i cann't simply say Open + 8 ticks
Because it only seems to know the open after the bar has closed.
So what i want to do is at the open of the SP500 day market, i want to buy open price (ie when market opens) + 8 ticks above or below
Any help or suggestions would be appreciated
How to buy x ticks away from open price
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: How to buy x ticks away from open price
Hello rkhan,
You need to use IOG to recalculate code on openining tick of next bar and use its value + 8 ticks to generate the order and send it on the second tick of the new bar. If the graph is not updating fast enough, you may need to use RecalcLastBarAfter(1).
You need to use IOG to recalculate code on openining tick of next bar and use its value + 8 ticks to generate the order and send it on the second tick of the new bar. If the graph is not updating fast enough, you may need to use RecalcLastBarAfter(1).
Re: How to buy x ticks away from open price
Dear Sir,
How is this possible?
All i want to do is buy 8 ticks above the opening price of the day.
But you see, to use a limit or stop order, i must use the code NEXT
if i use this, then i can only use CLOSE, but i dont want to buy on close.
Now, how will i know if it is the NEXT bar will be the opening bar?
So i cannot use NEXT, because i dont know if the next bar is the opening bar.
How is this possible?
All i want to do is buy 8 ticks above the opening price of the day.
But you see, to use a limit or stop order, i must use the code NEXT
if i use this, then i can only use CLOSE, but i dont want to buy on close.
Now, how will i know if it is the NEXT bar will be the opening bar?
So i cannot use NEXT, because i dont know if the next bar is the opening bar.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How to buy x ticks away from open price
When intra-bar order generation (IOG) is turned on, "next bars" means "next tick" because IOG will force the script to be re-evaluated on every price update, and not only on every bar.All i want to do is buy 8 ticks above the opening price of the day.
But you see, to use a limit or stop order, i must use the code NEXT
if i use this, then i can only use CLOSE, but i dont want to buy on close.
Now, how will i know if it is the NEXT bar will be the opening bar?
So i cannot use NEXT, because i dont know if the next bar is the opening bar.
Have you tried something like the following (purely an example):
Code: Select all
[IntrabarOrderGeneration = true];
Variables:
IntraBarPersist openPrice(0);
// Check for opening price of the day,
// on the first bar of the day
if (Date <> Date[1]) then begin
openPrice = Open + 2; // + 8 ES mini ticks
end;
// Submit the orders on all other bars
if (MarketPosition(0) = 0) and (openPrice <> 0) then begin
Buy 1 contracts next bar at openPrice limit;
end;