Code alterations

3/12/24 09:09 Key changes made:

  1. Removed all news-related code (don't know why it added that anyway)
  2. Removed horizontal market detection (redundant if trend analysis and stops are set correctly)
  3. Added new trend analysis based on:
    • TrendLength parameter
    • MinRateThreshold parameter
    • MinLineDifference parameter for red/white line separation
  4. 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
  5. Maintained all risk management features:
    • Stop loss and take profit
    • Trailing stop functionality
    • Position sizing options
  6. Kept core trading hours functionality (possibly unnecessary but leave for now)
  7. Maintained logging and reporting system

The main trading logic is now in OnTick():

  1. First checks if red line is sufficiently above white line
  2. If not, closes all positions
  3. If yes, calculates trend strength and direction
  4. Opens positions based on trend direction if threshold is met (upward will open buy position, downward will open sell position.)
  5. Maintains trailing stops if enabled

    So this should simplify and improve the code.

Comments

Popular posts from this blog

Stops and line based entry validation

Momentum

Strip back to core functionality