i try to understand the methode crossabove and Below, therefore I createt a simple strategy, and yes it trades a lot, but where is the signal coming from to trade?
public class Test2 : Strategy
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Strategy here.";
Name = "Test2";
Calculate = Calculate.OnPriceChange;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Gtc;
TraceOrders = true;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 20;
// Disable this property for performance gains in Strategy Analyzer optimizations
// See the Help Guide for additional information
IsInstantiatedOnEachOptimizationIteration = true;
}
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, 1);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 10)
return;
// Set 1
if (CrossAbove(GetCurrentAsk(0), High, 1))
{
EnterLong(Convert.ToInt32(DefaultQuantity), "Enter Long");
SetStopLoss("Enter Long", CalculationMode.Price, Low[0], false);
SetProfitTarget("Enter Long", CalculationMode.Ticks, 10);
}
}
}
is it possible to see the code for this methode, to understand how it works. The ninjatrader Help guide is to less for me.
thanks for your help!
lg


Comment