Description
Created by Volker Knapp
"The idea behind this system is to find opportune points at which to catch an intraday trend. It measures the change between five-minute bars to determine when a sharp, short-term move against the prevailing trend has occurred that is likely to be reversed. The goal is to enter when the market is actually in the process of making the pullback, rather than waiting for the pullback to complete and price to move beyond the most recent high (as do most breakout systems").
Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
// Dip size %
double Dip = 0.5;
// Stop Loss %
double StopLoss = 3.2;
int firstBar = 0;
double prevClose = 0;
// Check for intraday data
if ( Bars.IsIntraday )
{
// Get daily bars
SetScaleDaily();
Bars daily = Bars;
RestoreScale();
daily = Synchronize( daily );
PlotSeries( PricePane, daily.Close, Color.Black, WealthLab.LineStyle.Solid, 1 );
for(int bar = 20; bar < Bars.Count; bar++)
{
if( daily.IntradayBarNumber(bar) == 0 )
{
if( daily.Date[bar] > daily.Date[bar-1] )
{
firstBar = bar;
prevClose = daily.Close[bar-1];
}
if( bar == firstBar )
SetBarColor( bar, Color.Yellow );
}
if( IsLastPositionActive )
{
if ( Bars.IsLastBarOfDay( bar ) )
SellAtClose( bar, LastPosition, "At Close" );
SellAtStop( bar+1, LastPosition, LastPosition.EntryPrice * ( 1 - StopLoss/100 ), "Stop" );
} else
{
if( bar >= firstBar )
if( Bars.Close[bar] < ( Bars.Low[bar-1] * ( 1 - Dip/100 ) ) )
if( Bars.Close[bar] > prevClose )
BuyAtMarket( bar+1, "Buy" );
}
}
} else
DrawLabel( PricePane, "For use on intraday data", Color.Red );
}
}
}