- ago
Is there a module that does this:

Suppose you have

if (cond 1 && cond 2 + .... cond n)
{
Place trade
ShowDataWindow()
}

And data window shows the values for each cond? so lets say cond 1 is close is > 10, it displays the value of close

and the same thing for Position closes.

In python pandas this is kind of like the variable visualizers.

So if you click on the upwards triangle (long) a window opens up w/ the values...

Thank you.
0
65
2 Replies

Reply

Bookmark

Sort
Glitch8
 ( 9.82% )
- ago
#1
In my opinion the WL8 way would be to compose a custom signal name based on the conditions. Here in this example, you can see the last trade occurred because cond1 was true (1) while cond2 was false (0).

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) {          rsi4 = RSI.Series(bars.Close, 4);          cmo4 = CMO.Series(bars.Close, 4);          PlotIndicator(rsi4);          PlotIndicator(cmo4); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) { bool cond1 = rsi4[idx] < 40;             bool cond2 = cmo4[idx] < -80;             if (cond1 || cond2)             {                string sig = (cond1 ? "1" : "0") + (cond2 ? "1" : "0");                PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, sig);             } } else {             //code your sell conditions here             bool cond1 = rsi4[idx] > 60;             bool cond2 = cmo4[idx] > 80;             if (cond1 || cond2)             {                string sig = (cond1 ? "1" : "0") + (cond2 ? "1" : "0");                PlaceTrade(bars, TransactionType.Sell, OrderType.Market, 0, sig);             } } }       //declare private variables below       private RSI rsi4;       private CMO cmo4; } }


1
- ago
#2
Thank you for prompt reply... Will take a look.
0

Reply

Bookmark

Sort