1. enter with qty 2
2. exit with 1st target 10 ticks
3. trail stop 10 ticks
from what I've read so far, I would need the following:
EntriesPerDirection = 1;
EntryHandling = EntryHandling.UniqueEntries;
SetProfitTarget("Long 1a", CalculationMode.Ticks, 10);
SetTrailStop(CalculationMode.Ticks, 10);
EnterLong("Long 1a");
EnterLong("Long 1b");
I've tried inputting these but have gotten errors. I think it's from my labelling "Long 1a" in the wrong lines....
My working code so far (with qty 1):
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
Add(WMA(30));
SetStopLoss("", CalculationMode.Ticks, 20, false);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Close[0] > WMA(30)[0])
{
EnterLongStopLimit(DefaultQuantity, High[0] + 2 * TickSize, High[0] + 2 * TickSize, "");
}
// Condition set 2
if (Close[0] < EMA(9)[0])
{
ExitLong("", "");
}
}
Thank you in advance
Comment