Closed Carto1984 closed 2 years ago
This shouldn't happen anymore.
The fix was introduced here: c8595a718b937266559ab9ea2b3f1e594d63b04f
The statement break
disallowed checking the liquidate status of all trading equities.
Instead of break
, it was updated to continue
statement
TRADE RENMAINS OPEN UNTIL NEXT GAP OF 2%, TO REPLICATE THIS ISSUE TRY
PARAMETER GAP 2 LINE 212
THIS IS THE CODE I USED, I CHANGE
"self.ConsolidateSecondsTime = 60 5 # Define the one min candle." " trading_equity.LastEntryExitOnWinPrice = (trading_equity.LastEntryPrice + (trading_equity.LastEntryPrice - trading_equity.LastEntryExitOnLostPrice)2)"
CODE ------------
region imports
from hashlib import new from AlgorithmImports import * import enum
endregion
class LiquidateState(enum.Enum): Normal = 1 # It is not mandatory to liquidate. ToWin = 2 # It is mandatory to liquidate if there is a win or there is not a loss. Equity current price >= entry price. Force = 3 # Liquidate the equity now.
class VWAPStrategy(QCAlgorithm):
So far, all prices are based in USD dollar for any field.
self.LastEntryPrice = 1 <=> self.LastEntryPrice = 1 USD
class EquityTradeModel: def init(self, symbol, equity, default_gap_percent_to_trade = 2): self.symbol = symbol self.equity = equity
class QCEquityTradeModel(EquityTradeModel): def init(self, equity): EquityTradeModel.init(self, equity.Symbol, equity)
class StocksTrading: def init(self): self.equities = {}
class QCStocksTrading(StocksTrading): def init(self, qcAlgorithm): StocksTrading.init(self) self.__qcAlgorithm = qcAlgorithm