v5.4: FX trail start 1000 -> 500 pts (metals keep 1000)
100 pips was reachable on metals only — FX winners kept cycle-closing before the trail engaged (GBPUSD +70 pips Jul 15 had an unmoved SL). Input renamed InpTrailStart -> InpTrailStartPoints so every chart picks up the new 500 default on recompile without per-chart preset reloads; metal presets set it back to 1000 explicitly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,12 +5,12 @@
|
|||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "Copyright 2024, Garfield Heron"
|
#property copyright "Copyright 2024, Garfield Heron"
|
||||||
#property link "https://fetcherpay.com"
|
#property link "https://fetcherpay.com"
|
||||||
#property version "5.3"
|
#property version "5.4"
|
||||||
|
|
||||||
#include <Trade\Trade.mqh>
|
#include <Trade\Trade.mqh>
|
||||||
#include <Trade\PositionInfo.mqh>
|
#include <Trade\PositionInfo.mqh>
|
||||||
|
|
||||||
#define VERSION "Version 5.3 Smart Grid Breakout BO MT5"
|
#define VERSION "Version 5.4 Smart Grid Breakout BO MT5"
|
||||||
#define MAX_TRADES 600
|
#define MAX_TRADES 600
|
||||||
#define MAX_LOG_TRADES 1200
|
#define MAX_LOG_TRADES 1200
|
||||||
|
|
||||||
@@ -74,7 +74,10 @@ input int InpBreakevenBufferPoints = 5; // Spread cushion above entry
|
|||||||
//--- Trailing Stop (5.1)
|
//--- Trailing Stop (5.1)
|
||||||
input string TrailingSettings = "=== Trailing Stop ===";
|
input string TrailingSettings = "=== Trailing Stop ===";
|
||||||
input bool InpUseTrailingStop = false; // Enable trailing stop on open positions
|
input bool InpUseTrailingStop = false; // Enable trailing stop on open positions
|
||||||
input int InpTrailStart = 1000; // Points of profit before trail activates
|
// Renamed from InpTrailStart in 5.4 so all charts pick up the new 500pt
|
||||||
|
// default on recompile (renamed inputs reset to source default; the old
|
||||||
|
// 1000pt start was reachable on metals only — presets set metals back to 1000).
|
||||||
|
input int InpTrailStartPoints = 500; // Points of profit before trail activates
|
||||||
input int InpTrailStop = 500; // Trail distance behind price (points)
|
input int InpTrailStop = 500; // Trail distance behind price (points)
|
||||||
|
|
||||||
//--- Correlation Cap (4.3)
|
//--- Correlation Cap (4.3)
|
||||||
@@ -861,12 +864,12 @@ void ApplyBreakeven()
|
|||||||
void ApplyTrailingStop()
|
void ApplyTrailingStop()
|
||||||
{
|
{
|
||||||
if(!InpUseTrailingStop) return;
|
if(!InpUseTrailingStop) return;
|
||||||
if(InpTrailStart <= 0 || InpTrailStop <= 0) return;
|
if(InpTrailStartPoints <= 0 || InpTrailStop <= 0) return;
|
||||||
|
|
||||||
double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
|
double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
|
||||||
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
|
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
|
||||||
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
|
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
|
||||||
double trailStart = InpTrailStart * point;
|
double trailStart = InpTrailStartPoints * point;
|
||||||
double trailDist = InpTrailStop * point;
|
double trailDist = InpTrailStop * point;
|
||||||
|
|
||||||
for(int i = PositionsTotal() - 1; i >= 0; i--)
|
for(int i = PositionsTotal() - 1; i >= 0; i--)
|
||||||
@@ -1283,7 +1286,7 @@ int OnInit()
|
|||||||
|
|
||||||
PrintS(VERSION + " initialized — Magic=" + IntegerToString(MagicNum) +
|
PrintS(VERSION + " initialized — Magic=" + IntegerToString(MagicNum) +
|
||||||
" SL=" + (InpUseStopLoss ? "ON(" + IntegerToString(StopLoss) + ")" : "OFF") +
|
" SL=" + (InpUseStopLoss ? "ON(" + IntegerToString(StopLoss) + ")" : "OFF") +
|
||||||
" Trail=" + (InpUseTrailingStop ? "ON(start=" + IntegerToString(InpTrailStart) +
|
" Trail=" + (InpUseTrailingStop ? "ON(start=" + IntegerToString(InpTrailStartPoints) +
|
||||||
"/dist=" + IntegerToString(InpTrailStop) + "pts)" : "OFF") +
|
"/dist=" + IntegerToString(InpTrailStop) + "pts)" : "OFF") +
|
||||||
" AdaptiveEntry=" + (InpAdaptiveEntry ? "ON" : "OFF"));
|
" AdaptiveEntry=" + (InpAdaptiveEntry ? "ON" : "OFF"));
|
||||||
return INIT_SUCCEEDED;
|
return INIT_SUCCEEDED;
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=180
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=300
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ StopLoss=200
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=200
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=400
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=300
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ StopLoss=800
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=350
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ StopLoss=300
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=280
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ StopLoss=200
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=300
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ StopLoss=280
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ StopLoss=300
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ StopLoss=800
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=500
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ StopLoss=1000
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=1000
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ StopLoss=1500
|
|||||||
|
|
||||||
; === Trailing Stop ===
|
; === Trailing Stop ===
|
||||||
InpUseTrailingStop=true
|
InpUseTrailingStop=true
|
||||||
InpTrailStart=1000
|
InpTrailStartPoints=1000
|
||||||
InpTrailStop=500
|
InpTrailStop=500
|
||||||
|
|
||||||
; === Risk Management ===
|
; === Risk Management ===
|
||||||
|
|||||||
Reference in New Issue
Block a user