I want to backtest simple strategy:
- D1 bars
- depending the conditions: I want to buy on the next bar Open and sell on the bar Close.
How to achieve it ?
Regards
Buy OnOpen Sell OnClose
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Buy OnOpen Sell OnClose
Hello green7,
"Next bar Open" and "this bar Close" cannot be combined in a single signal.
Therefore you need to create two individual signals and apply them to the same chart:
"Next bar Open" and "this bar Close" cannot be combined in a single signal.
Therefore you need to create two individual signals and apply them to the same chart:
Code: Select all
if marketposition=0 then buy next bar at open next bar limit;
Code: Select all
if marketposition=1 then sell this bar on close;
Re: Buy OnOpen Sell OnClose
Of course I want to close on next bar Close.Hello green7,
"Next bar Open" and "this bar Close" cannot be combined in a single signal.
Therefore you need to create two individual signals and apply them to the same chart:Code: Select all
if marketposition=0 then buy next bar at open next bar limit;
Code: Select all
if marketposition=1 then sell this bar on close;
Could you give me small hint how to make this in MC.NET strategy ?
Regards
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Buy OnOpen Sell OnClose
Please see CalcAtOpenNextBarAttribute in 4.6.6_Calculation_per_Bar and the prebuilt Volty_Expan_Open_LE signal.Of course I want to close on next bar Close.
Could you give me small hint how to make this in MC.NET strategy ?
For exit - MarketThisBar in 4.6.1_Orders.