Code alterations
3/12/24 09:09 Key changes made:
- Removed all news-related code (don't know why it added that anyway)
- Removed horizontal market detection (redundant if trend analysis and stops are set correctly)
- Added new trend analysis based on:
- TrendLength parameter
- MinRateThreshold parameter
- MinLineDifference parameter for red/white line separation
- Modified main trading logic to:
- First check if red line is above white line by minimum difference
- Calculate rate of change over trend length period
- Open positions based on trend direction if threshold is met
- Maintained all risk management features:
- Stop loss and take profit
- Trailing stop functionality
- Position sizing options
- Kept core trading hours functionality (possibly unnecessary but leave for now)
- Maintained logging and reporting system
The main trading logic is now in OnTick():
- First checks if red line is sufficiently above white line
- If not, closes all positions
- If yes, calculates trend strength and direction
- Opens positions based on trend direction if threshold is met (upward will open buy position, downward will open sell position.)
- Maintains trailing stops if enabled
So this should simplify and improve the code.
Comments
Post a Comment