The strategy itself is under development, what is bothering me are these red lines and some blue lines on the graph when I run the backtest, how can I remove them and leave only the arrows?

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript2 { 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) { kUp = new KeltnerUpper(bars, 10); kLower = new KeltnerLower(bars, 10); PlotIndicatorLine(kUp, WLColor.Red); PlotIndicatorLine(kLower, WLColor.Green); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { //int index = idx; { if (bars.Low[idx] <= kLower[idx]) { Backtester.CancelationCode = 1; _transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, 0, signalName: "Buy"); } } { foreach (Position foundPosition0 in OpenPositions) { if (foundPosition0.PositionTag == 0) { Backtester.CancelationCode = 1; value = (10.00 / 100.0) + 1.0; ClosePosition(foundPosition0, OrderType.Limit, foundPosition0.EntryPrice * value, ""); } } } } //declare private variables below private double value, targetPrice; private Transaction _transaction; IndicatorBase kUp, kLower; //Transaction t; } }
Rename
Preferences > Chart > (disable) Show Trade Signal Lines.
That strategy leaves a lot of open positions.
That strategy leaves a lot of open positions.
QUOTE:
That strategy leaves a lot of open positions.
It might be easier to develop a single-position per symbol strategy first and get that running well. Afterwards, you can convert it to a multiple-position per symbol strategy latter. The Keltner channel strategy is a good example of a single-position per symbol strategy. https://www.wealth-lab.com/Discussion/Keltner-Channel-strategy-11464 It's much simpler to setup.
Managing multiple positions per symbol is hard and complicated. Learn to walk before you try to run.
Your Response
Post
Edit Post
Login is required