mirror of
https://github.com/rithsila/MT5-EA-Sniper-Strategy.git
synced 2026-08-20 06:13:11 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
|
||||
// Next line assumes this file is located in .../Frameworks/Extensions/someFolder
|
||||
#include "../../Framework.mqh"
|
||||
|
||||
class GridTPSL : public CTPSLBase {
|
||||
|
||||
private:
|
||||
|
||||
double GetValue();
|
||||
|
||||
protected: // member variables
|
||||
|
||||
// Place any required member variables here
|
||||
|
||||
public: // constructors
|
||||
|
||||
// Add any required constructor arguments
|
||||
// e.g. CTPSLXYZ(int periods, double multiplier)
|
||||
GridTPSL() : CTPSLBase() { Init(); }
|
||||
// Same constructor with symbol and timeframe added
|
||||
GridTPSL(string symbol, ENUM_TIMEFRAMES timeframe)
|
||||
: CTPSLBase(symbol, timeframe) { Init(); }
|
||||
~GridTPSL() { }
|
||||
|
||||
int Init();
|
||||
|
||||
public:
|
||||
|
||||
// Get and Set functions for additional parameters
|
||||
|
||||
// Override these from the parent class to get required values
|
||||
// GetValue here is just an example
|
||||
virtual double GetTakeProfit() { return(GetValue()); }
|
||||
virtual double GetStopLoss() { return(GetValue()); }
|
||||
|
||||
};
|
||||
|
||||
int GridTPSL::Init() {
|
||||
|
||||
// Checks if init has been set to fail by any parent class already
|
||||
if (InitResult()!=INIT_SUCCEEDED) return(InitResult());
|
||||
|
||||
// Assign variables and do any other initialisation here
|
||||
|
||||
return(INIT_SUCCEEDED);
|
||||
|
||||
}
|
||||
|
||||
// A simple example of a value function
|
||||
double GridTPSL::GetValue() {
|
||||
|
||||
// Pulls data from an assigned indicator number 0 for bar 1 and multiplies by 2
|
||||
double value = 0;//GetIndicatorData(0, 1)*2;
|
||||
|
||||
return(value);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
TPSLSimple.mqh
|
||||
|
||||
Copyright 2013-2020, Orchard Forex
|
||||
https://www.orchardforex.com
|
||||
|
||||
*/
|
||||
|
||||
#include "../../Framework.mqh"
|
||||
|
||||
class CTPSLSimple : public CTPSLBase {
|
||||
|
||||
private:
|
||||
|
||||
double GetValue();
|
||||
|
||||
protected: // member variables
|
||||
|
||||
double mMultiplier;
|
||||
int mIndex;
|
||||
|
||||
public: // constructors
|
||||
|
||||
CTPSLSimple() : CTPSLBase() { Init(); }
|
||||
CTPSLSimple(string symbol, ENUM_TIMEFRAMES timeframe)
|
||||
: CTPSLBase(symbol, timeframe) { Init(); }
|
||||
~CTPSLSimple() { }
|
||||
|
||||
int Init();
|
||||
|
||||
public:
|
||||
|
||||
virtual void SetIndex(int index) { mIndex = index; }
|
||||
virtual double GetIndex() { return(mIndex); }
|
||||
|
||||
virtual void SetMultiplier(double multiplier) { mMultiplier = multiplier; }
|
||||
virtual double GetMultiplier() { return(mMultiplier); }
|
||||
|
||||
virtual double GetTakeProfit() { return(GetValue()); }
|
||||
virtual double GetStopLoss() { return(GetValue()); }
|
||||
|
||||
};
|
||||
|
||||
int CTPSLSimple::Init() {
|
||||
|
||||
if (InitResult()!=INIT_SUCCEEDED) return(InitResult());
|
||||
|
||||
mMultiplier = 1.0;
|
||||
|
||||
return(INIT_SUCCEEDED);
|
||||
|
||||
}
|
||||
|
||||
double CTPSLSimple::GetValue() {
|
||||
|
||||
double value = 0;//GetIndicatorData(0, mIndex)*mMultiplier;
|
||||
|
||||
return(value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
TPSLTemplate.mqh
|
||||
Updated as of framework version 2.02
|
||||
|
||||
Copyright 2013-2020, Orchard Forex
|
||||
https://www.orchardforex.com
|
||||
|
||||
*/
|
||||
|
||||
// Next line assumes this file is located in .../Frameworks/Extensions/someFolder
|
||||
#include "../../Framework.mqh"
|
||||
|
||||
class CTPSLTemplate : public CTPSLBase {
|
||||
|
||||
private:
|
||||
|
||||
double GetValue();
|
||||
|
||||
protected: // member variables
|
||||
|
||||
// Place any required member variables here
|
||||
|
||||
public: // constructors
|
||||
|
||||
// Add any required constructor arguments
|
||||
// e.g. CTPSLXYZ(int periods, double multiplier)
|
||||
CTPSLTemplate() : CTPSLBase() { Init(); }
|
||||
// Same constructor with symbol and timeframe added
|
||||
CTPSLTemplate(string symbol, ENUM_TIMEFRAMES timeframe)
|
||||
: CTPSLBase(symbol, timeframe) { Init(); }
|
||||
~CTPSLTemplate() { }
|
||||
|
||||
int Init();
|
||||
|
||||
public:
|
||||
|
||||
// Get and Set functions for additional parameters
|
||||
|
||||
// Override these from the parent class to get required values
|
||||
// GetValue here is just an example
|
||||
virtual double GetTakeProfit() { return(GetValue()); }
|
||||
virtual double GetStopLoss() { return(GetValue()); }
|
||||
|
||||
};
|
||||
|
||||
int CTPSLTemplate::Init() {
|
||||
|
||||
// Checks if init has been set to fail by any parent class already
|
||||
if (InitResult()!=INIT_SUCCEEDED) return(InitResult());
|
||||
|
||||
// Assign variables and do any other initialisation here
|
||||
|
||||
return(INIT_SUCCEEDED);
|
||||
|
||||
}
|
||||
|
||||
// A simple example of a value function
|
||||
double CTPSLTemplate::GetValue() {
|
||||
|
||||
// Pulls data from an assigned indicator number 0 for bar 1 and multiplies by 2
|
||||
double value = 0;//GetIndicatorData(0, 1)*2;
|
||||
|
||||
return(value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user