- ago
Has anyone found a way to buy at market close and sell at the opening, every day of the week (ie no day left without a trade)? Thanks for any help .. I have tried the new same-day possibilities without success
0
407
Solved
6 Replies

Reply

Bookmark

Sort
Glitch8
 ( 11.64% )
- ago
#1
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) {          PlaceTrade(bars, TransactionType.Buy, OrderType.MarketClose);          PlaceTrade(bars, TransactionType.Sell, OrderType.Market); } } }
0
Cone8
 ( 6.07% )
- ago
#2
Assumes Daily bars.
(Title specified "using Building Blocks")

0
Best Answer
- ago
#3
Thank you Cone, the BB solution leaves 1 gap day. Is it possible to compress to same day marketclose using BB?

0
- ago
#4
Thank you Glitch . Your c# code definitely works !!! Wasn't able to make it work in BB - see prior comments, is it possible in BB?

0
Cone8
 ( 6.07% )
- ago
#5
It doesn't leave a gap day if you set it up like the picture.
(Hint: Multiple Positions)

What's the point of this?
0
- ago
#6
Thanks much Cone - my bad, I missed Multiple Positions on. All good now !
0

Reply

Bookmark

Sort