/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { state = getNewState(); switch (state) { case StateAutomate.PREPA: preparePosition(); break; case StateAutomate.ENTER: enterBuyPosition(); break; case StateAutomate.FIRST_EXIT: exitFirstBuyPosition(); break; case StateAutomate.SECOND_EXIT: checkToExitSecondBuyPosition(); break; case StateAutomate.STOP_LOSS_EXIT: exitStopLoss(); break; case StateAutomate.WAITING: default: return; } }
/// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { // Calculate on the close of each bar CalculateOnBarClose = false; resetAfterAllPositionsExited(); state = StateAutomate.WAITING; }
/// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { // Calculate on the close of each bar CalculateOnBarClose = false; modePrepa = false; modeAction = false; firstVolumeExited = false; profitAfterFirstExit = 0; maxProfitAfterFirstExit = 0; baseValueEMAWhenFirstExit = 0; state = StateAutomate.WAITING; }