The code essentials are:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
IsAdoptAccountPositionAware = true;
StartBehavior = StartBehavior.AdoptAccountPosition;
}
else if (State == State.Configure)
{
SetProfitTarget(CalculationMode.Price, ProfitTargetPrice);
SetStopLoss(CalculationMode.Ticks, StopLossTicks);
}
}
protected override void OnBarUpdate()
{
//do something
}
The instructions for SetStopLoss() and SetProfitTarget() say:
Is there a way for a strategy to adopt an account position and then apply a stop loss and profit target?

Comment