- ago
Hi,

I don't have currently WL with an intraday data, so can someone who has it, can u please build it and show the results.

Rules:

Go short at the close of the first 5min candle, if UVXY trades above its 5-Period SMA on a Daily timeframe, exit and the session close, stop-loss 10%.

Allocate 50% of the equity per trade, my starting was $2000.

I have this strategy on Amibroker





I want to double check, whether I am actually on something or I my code peaks into future.

Thanks
0
716
Solved
1 Replies

Reply

Bookmark

Sort
- ago
#1
Here is a rough 5-minute interval strategy with the rules you want. Backtested since 1/1/2016 with 1M start since UVXY split adjusted is very high.
APR: 11% Drawdown -55%
win Rate: 59%

I wouldn't trade this strategy.



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 {       TimeSeries daily;       TimeSeries sma5; public override void Initialize(BarHistory bars) {          daily = TimeSeriesCompressor.ToDaily(bars.Close);          sma5 = new SMA(daily, 5);          sma5 = TimeSeriesSynchronizer.Synchronize(sma5, bars);          daily = TimeSeriesSynchronizer.Synchronize(daily, bars); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int bar) {          int barTime = bars.DateTimes[bar].Hour * 100 + bars.DateTimes[bar].Minute;           if (LastOpenPosition == null || !LastOpenPosition.IsOpen) {             if(barTime == 0935 && daily[bar] > sma5[bar])             {                Transaction transaction = PlaceTrade(bars, TransactionType.Short, OrderType.Market);                transaction.Quantity = (int)(0.5 * CurrentEquity / bars.Close[bar]);             } }          if(LastOpenPosition != null && LastOpenPosition.IsOpen)          {             double gain = LastOpenPosition.ProfitPctAsOf(bar);             if(gain < -10.0 || barTime >= 1555)             {                ClosePosition(LastOpenPosition, OrderType.Market);             }          } } //declare private variables below } }



0
Best Answer

Reply

Bookmark

Sort