Hi,
In intra-day auto-trade, the 'default' action is to open and close a position at Open of next bar. Is it possible to close a position right before say e.g., the end of a 5 min bar ?
Thanks.
Close position at bar end / real time
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: Close position at bar end / real time
Maybe using a counter?Hi,
In intra-day auto-trade, the 'default' action is to open and close a position at Open of next bar. Is it possible to close a position right before say e.g., the end of a 5 min bar ?
Thanks.
Using barinterval keyword to know which resolution you're using and build your counter based on that.
Just an idea.
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Close position at bar end / real time
Hello LMC1,
You may need to use RecalcLastBarAfter keyword in your code (IOG must be on) to call some artificial script calculation if there is no tick and to place an order before the current bar close.
You may need to use RecalcLastBarAfter keyword in your code (IOG must be on) to call some artificial script calculation if there is no tick and to place an order before the current bar close.