Skip to content

Instantly share code, notes, and snippets.

View crgone1's full-sized avatar

Jason Drury crgone1

View GitHub Profile
@currencysecrets
currencysecrets / getATRTrailingStop.mq4
Last active September 11, 2022 02:51
ATR Trailing Stop method - these are the ATR trailing stop functions I use to calculate my automatic stops. Aspects within this code that need to be added are the checking of the Trading Content being free and (optional) better error reporting.
//+------------------------------------------------------------------+
//| calculate-atr-trailing-stop.mq4
//| Copyright 2013, Currency Secrets
//| http://www.currencysecrets.com
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Currency Secrets"
#property link "http://www.currencysecrets.com"
//--- input parameters
extern int extLookBack = 50; // bars to look back for the ATR indicator