mirror of
https://github.com/rithsila/MT5-EA-Sniper-Strategy.git
synced 2026-08-19 05:38:15 +00:00
Add GDea files
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
|
||||
MA Crossover.mq4
|
||||
|
||||
Copyright 2013-2020, Orchard Forex
|
||||
https://www.orchardforex.com
|
||||
|
||||
Description:
|
||||
|
||||
*/
|
||||
|
||||
#property copyright "Copyright 2013-2020, Orchard Forex"
|
||||
#property link "https://www.orchardforex.com"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// This is where we pull in the framework
|
||||
//
|
||||
#include <Orchard/Frameworks/Framework.mqh>
|
||||
|
||||
//
|
||||
// Input Section
|
||||
//
|
||||
// Fast moving average
|
||||
input int InpFastPeriods = 10; // Fast periods
|
||||
input ENUM_MA_METHOD InpFastMethod = MODE_SMA; // Fast method
|
||||
input ENUM_APPLIED_PRICE InpFastAppliedPrice = PRICE_CLOSE; // Fast price
|
||||
|
||||
// Slow moving average
|
||||
input int InpSlowPeriods = 20; // Slow periods
|
||||
input ENUM_MA_METHOD InpSlowMethod = MODE_SMA; // Slow method
|
||||
input ENUM_APPLIED_PRICE InpSlowAppliedPrice = PRICE_CLOSE; // Slow price
|
||||
|
||||
// Bar numbers for comparison
|
||||
//input int InpBar2 = 2; // Base bar number
|
||||
//input int InpBar1 = 1; // Crossover bar number
|
||||
|
||||
//
|
||||
// Some standard inputs,
|
||||
// remember to change the default magic for each EA
|
||||
//
|
||||
input double InpVolume = 0.01; // Default order size
|
||||
input string InpComment = __FILE__; // Default trade comment
|
||||
input int InpMagicNumber = 20200701; // Magic Number
|
||||
|
||||
//
|
||||
// Declare the expert, use the child class name
|
||||
//
|
||||
#define CExpert CExpertBase
|
||||
CExpert *Expert;
|
||||
|
||||
//
|
||||
// Signals, use the child class names if applicable
|
||||
//
|
||||
CSignalBase *EntrySignal;
|
||||
CSignalBase *ExitSignal;
|
||||
|
||||
//
|
||||
// Indicators - use the child class name here
|
||||
//
|
||||
CIndicatorMA *FastIndicator;
|
||||
CIndicatorMA *SlowIndicator;
|
||||
|
||||
int OnInit() {
|
||||
|
||||
//
|
||||
// Instantiate the expert
|
||||
//
|
||||
Expert = new CExpert();
|
||||
|
||||
//
|
||||
// Assign the default values to the expert
|
||||
//
|
||||
Expert.SetVolume(InpVolume);
|
||||
Expert.SetTradeComment(InpComment);
|
||||
Expert.SetMagic(InpMagicNumber);
|
||||
|
||||
//
|
||||
// Create the indicators
|
||||
//
|
||||
FastIndicator = new CIndicatorMA(InpFastPeriods, 0, InpFastMethod, InpFastAppliedPrice);
|
||||
SlowIndicator = new CIndicatorMA(InpSlowPeriods, 0, InpSlowMethod, InpSlowAppliedPrice);
|
||||
|
||||
//
|
||||
// Set up the signals
|
||||
//
|
||||
EntrySignal = new CSignalCrossover();
|
||||
EntrySignal.AddIndicator(FastIndicator, 0);
|
||||
EntrySignal.AddIndicator(SlowIndicator, 0);
|
||||
|
||||
//ExitSignal = Not needed, using the same signal as entry
|
||||
|
||||
//
|
||||
// Add the signals to the expert
|
||||
//
|
||||
Expert.AddEntrySignal(EntrySignal);
|
||||
Expert.AddExitSignal(EntrySignal); // Same signal
|
||||
|
||||
//
|
||||
// Finish expert initialisation and check result
|
||||
//
|
||||
int result = Expert.OnInit();
|
||||
|
||||
return(result);
|
||||
|
||||
}
|
||||
|
||||
void OnDeinit(const int reason) {
|
||||
|
||||
EventKillTimer();
|
||||
|
||||
delete Expert;
|
||||
//delete ExitSignal;
|
||||
delete EntrySignal;
|
||||
delete FastIndicator;
|
||||
delete SlowIndicator;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTick() {
|
||||
|
||||
Expert.OnTick();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTimer() {
|
||||
|
||||
Expert.OnTimer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
double OnTester() {
|
||||
|
||||
return(Expert.OnTester());
|
||||
|
||||
}
|
||||
|
||||
void OnChartEvent(const int id,
|
||||
const long &lparam,
|
||||
const double &dparam,
|
||||
const string &sparam) {
|
||||
|
||||
Expert.OnChartEvent(id, lparam, dparam, sparam);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
|
||||
MA Crossover.mq5
|
||||
|
||||
Copyright 2013-2020, Orchard Forex
|
||||
https://www.orchardforex.com
|
||||
|
||||
Description:
|
||||
|
||||
*/
|
||||
|
||||
#property copyright "Copyright 2013-2020, Orchard Forex"
|
||||
#property link "https://www.orchardforex.com"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// This is where we pull in the framework
|
||||
//
|
||||
#include <Nkanven/Frameworks/GDeaFramework.mqh>
|
||||
|
||||
//
|
||||
// Input Section
|
||||
//
|
||||
// Fast moving average
|
||||
input int InpFastPeriods = 10; // Fast periods
|
||||
input ENUM_MA_METHOD InpFastMethod = MODE_SMA; // Fast method
|
||||
input ENUM_APPLIED_PRICE InpFastAppliedPrice = PRICE_CLOSE; // Fast price
|
||||
|
||||
// Slow moving average
|
||||
input int InpSlowPeriods = 20; // Slow periods
|
||||
input ENUM_MA_METHOD InpSlowMethod = MODE_SMA; // Slow method
|
||||
input ENUM_APPLIED_PRICE InpSlowAppliedPrice = PRICE_CLOSE; // Slow price
|
||||
|
||||
// Bar numbers for comparison
|
||||
//input int InpBar2 = 2; // Base bar number
|
||||
//input int InpBar1 = 1; // Crossover bar number
|
||||
|
||||
//
|
||||
// Some standard inputs,
|
||||
// remember to change the default magic for each EA
|
||||
//
|
||||
input double InpVolume = 0.01; // Default order size
|
||||
input string InpComment = __FILE__; // Default trade comment
|
||||
input int InpMagicNumber = 20200701; // Magic Number
|
||||
|
||||
//
|
||||
// Declare the expert, use the child class name
|
||||
//
|
||||
#define CExpert CExpertBase
|
||||
CExpert *Expert;
|
||||
|
||||
//
|
||||
// Signals, use the child class names if applicable
|
||||
//
|
||||
CSignalBase *EntrySignal;
|
||||
CSignalBase *ExitSignal;
|
||||
|
||||
//
|
||||
// Indicators - use the child class name here
|
||||
//
|
||||
CIndicatorMA *FastIndicator;
|
||||
CIndicatorMA *SlowIndicator;
|
||||
|
||||
int OnInit() {
|
||||
|
||||
//
|
||||
// Instantiate the expert
|
||||
//
|
||||
Expert = new CExpert();
|
||||
|
||||
//
|
||||
// Assign the default values to the expert
|
||||
//
|
||||
Expert.SetVolume(InpVolume);
|
||||
Expert.SetTradeComment(InpComment);
|
||||
Expert.SetMagic(InpMagicNumber);
|
||||
|
||||
//
|
||||
// Create the indicators
|
||||
//
|
||||
FastIndicator = new iMA(Symbol(), PERIOD_CURRENT, InpFastPeriods, 0, InpFastMethod, InpFastAppliedPrice);
|
||||
SlowIndicator = new iMA(Symbol(), PERIOD_CURRENT, InpSlowPeriods, 0, InpSlowMethod, InpSlowAppliedPrice);
|
||||
|
||||
//
|
||||
// Set up the signals
|
||||
//
|
||||
EntrySignal = new CSignalCrossover();
|
||||
EntrySignal.AddIndicator(FastIndicator, 0);
|
||||
EntrySignal.AddIndicator(SlowIndicator, 0);
|
||||
|
||||
//ExitSignal = Not needed, using the same signal as entry
|
||||
|
||||
//
|
||||
// Add the signals to the expert
|
||||
//
|
||||
Expert.AddEntrySignal(EntrySignal);
|
||||
Expert.AddExitSignal(EntrySignal); // Same signal
|
||||
|
||||
//
|
||||
// Finish expert initialisation and check result
|
||||
//
|
||||
int result = Expert.OnInit();
|
||||
|
||||
return(result);
|
||||
|
||||
}
|
||||
|
||||
void OnDeinit(const int reason) {
|
||||
|
||||
EventKillTimer();
|
||||
|
||||
delete Expert;
|
||||
//delete ExitSignal;
|
||||
delete EntrySignal;
|
||||
delete FastIndicator;
|
||||
delete SlowIndicator;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTick() {
|
||||
|
||||
Expert.OnTick();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTimer() {
|
||||
|
||||
Expert.OnTimer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTrade() {
|
||||
|
||||
Expert.OnTrade();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTradeTransaction(const MqlTradeTransaction& trans,
|
||||
const MqlTradeRequest& request,
|
||||
const MqlTradeResult& result) {
|
||||
|
||||
Expert.OnTradeTransaction(trans, request, result);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
double OnTester() {
|
||||
|
||||
return(Expert.OnTester());
|
||||
|
||||
}
|
||||
|
||||
void OnTesterInit() {
|
||||
|
||||
Expert.OnTesterInit();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTesterPass() {
|
||||
|
||||
Expert.OnTesterPass();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnTesterDeinit() {
|
||||
|
||||
Expert.OnTesterDeinit();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnChartEvent(const int id,
|
||||
const long &lparam,
|
||||
const double &dparam,
|
||||
const string &sparam) {
|
||||
|
||||
Expert.OnChartEvent(id, lparam, dparam, sparam);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void OnBookEvent(const string &symbol) {
|
||||
|
||||
Expert.OnBookEvent();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,284 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| SnT Bot.mq5 |
|
||||
//| Copyright 2021, Nkondog Anselme Venceslas |
|
||||
//| https://www.mql5.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2021, Nkondog Anselme Venceslas"
|
||||
#property link "https://www.salixnigra.com"
|
||||
#property version "1.0"
|
||||
|
||||
#include <Nkanven/Frameworks/GridFramework.mqh>
|
||||
|
||||
//
|
||||
// Input Section
|
||||
//
|
||||
|
||||
//This is where you should include the input parameters for your entry and exit signals
|
||||
input string Comment_strategy="=========="; //Entry And Exit Settings
|
||||
//Add in this section the parameters for the indicators used in your entry and exit
|
||||
|
||||
//General input parameters
|
||||
input string Comment_0="=========="; //Risk Management Settings
|
||||
input ENUM_RISK_DEFAULT_SIZE InpRiskDefaultSize=RISK_DEFAULT_AUTO; //Position Size Mode
|
||||
input double InpDefaultLotSize=1; //Position Size (if fixed or if no stop loss defined)
|
||||
input ENUM_RISK_BASE InpRiskBase=RISK_BASE_BALANCE; //Risk Base
|
||||
input double InpMaxRiskPerTrade=0.5; //Percentage To Risk Each Trade
|
||||
input double InpProfitPercent=1;
|
||||
input double InpMinLotSize=0.01; //Min Lot Size
|
||||
input double InpMaxLotSize=100; //Max Lot Size
|
||||
|
||||
|
||||
input string Comment_1="=========="; //Trading Hours Settings
|
||||
input bool InpUseTradingHours=false; //Activate Trading Hours
|
||||
input string InpTradingHourStart="01"; //Trading Start Hour (Broker Server Hour)
|
||||
input string InpTradingStartMin="30"; //Trading Start minute
|
||||
input string InpTradingHourEnd="23"; //Trading End Hour (Broker Server Hour)
|
||||
input string InpTradingEndMin="00"; //Trading End minute
|
||||
input bool InpUseTradingSession=true;
|
||||
input ENUM_TRADING_SESSION InpTradingSession = LONDON_SESSION; //Trading session
|
||||
|
||||
input string Comment_2="=========="; //Trading Hours Settings
|
||||
input int InpGridGap = 1000;
|
||||
|
||||
input double InpVolume = 0.01; //Default order size
|
||||
input string InpComment = __FILE__; //Default trade comment
|
||||
input int InpMagicNumber = 20200701; //Magic Number
|
||||
input int InpBrokerTimeZoneGMT = 2; //Broker timezone from GMT
|
||||
input int InpSlippage = 2; //Slippage
|
||||
input int not_used;
|
||||
|
||||
int londonSession[] = {7, 17};
|
||||
int newyorkSession[] = {13, 23};
|
||||
int tokyoSession[] = {0, 6};
|
||||
|
||||
//
|
||||
// Declare the expert
|
||||
//
|
||||
#define CExpert CExpertBase
|
||||
CExpert *Expert;
|
||||
|
||||
//
|
||||
// Signals
|
||||
//
|
||||
CSignalGrid *EntrySignal;
|
||||
CSignalGrid *ExitSignal;
|
||||
|
||||
//
|
||||
// TPSL - use child class names instead of CTPSLBase
|
||||
//
|
||||
GridTPSL *TPObject;
|
||||
GridTPSL *SLObject;
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnInit()
|
||||
{
|
||||
|
||||
//
|
||||
// Instantiate the expert, use the child class name
|
||||
//
|
||||
Expert = new CExpert();
|
||||
|
||||
//
|
||||
// Assign the default values to the expert
|
||||
//
|
||||
Expert.SetVolume(InpVolume);
|
||||
Expert.SetTradeComment(InpComment);
|
||||
Expert.SetMagic(InpMagicNumber);
|
||||
Expert.SetDefaultLotSize(InpDefaultLotSize);
|
||||
Expert.SetGridGap(InpGridGap);
|
||||
Expert.SetGridNumber(10);
|
||||
Expert.SetMaxLotSize(InpMaxLotSize);
|
||||
Expert.SetMaxRiskPerTrade(InpMaxRiskPerTrade);
|
||||
Expert.SetMinLotSize(InpMinLotSize);
|
||||
Expert.SetRiskBase(InpRiskBase);
|
||||
Expert.SetRiskDefaultSize(InpRiskDefaultSize);
|
||||
Expert.SetUseTradingSession(InpTradingSession);
|
||||
Expert.SetSlippage(InpSlippage);
|
||||
Expert.SetProfitPercent(InpProfitPercent);
|
||||
|
||||
//
|
||||
// Set up the signals
|
||||
//
|
||||
//EntrySignal = new CSignalGrid();
|
||||
//EntrySignal.SetMaxRiskPerTrade(InpMaxRiskPerTrade);
|
||||
//EntrySignal.setMmagic(InpMagicNumber);
|
||||
//EntrySignal.AddIndicator(Indicator1, 0);
|
||||
|
||||
//ExitSignal = new CSignalGrid();
|
||||
//ExitSignal.SetMaxRiskPerTrade(InpMaxRiskPerTrade);
|
||||
//ExitSignal.setMmagic(InpMagicNumber);
|
||||
//ExitSignal.AddIndicator(Indicator1, 0);
|
||||
|
||||
//
|
||||
// Add the signals to the expert
|
||||
//
|
||||
//Expert.AddEntrySignal(EntrySignal);
|
||||
//Expert.AddExitSignal(ExitSignal);
|
||||
|
||||
//
|
||||
// If using fixed tp and sl set them here in points
|
||||
//
|
||||
Expert.SetTakeProfitValue(0);
|
||||
Expert.SetStopLossValue(0);
|
||||
|
||||
//
|
||||
// Set up the Take Profit and Stop Loss objects
|
||||
// Remember to create child class names, not base
|
||||
//
|
||||
TPObject = new GridTPSL(); // Create the object
|
||||
//IndicatorTPSL1 = new CIndicatorBase(); // Create an indicator for the tp object
|
||||
//TPObject.AddIndicator(IndicatorTPSL1, 0); // Add the indicator to tp
|
||||
// Set any other properties needed
|
||||
|
||||
// And for the SL object
|
||||
SLObject = new GridTPSL();
|
||||
//IndicatorTPSL2 = new CIndicatorBase();
|
||||
//SLObject.AddIndicator(IndicatorTPSL2, 0);
|
||||
|
||||
Expert.SetTakeProfitObj(TPObject);
|
||||
Expert.SetStopLossObj(SLObject);
|
||||
|
||||
//
|
||||
// Finish expert initialisation and check result
|
||||
//
|
||||
int result = Expert.OnInit();
|
||||
|
||||
return(result);
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
|
||||
EventKillTimer();
|
||||
|
||||
delete Expert;
|
||||
delete ExitSignal;
|
||||
delete EntrySignal;
|
||||
delete TPObject;
|
||||
delete SLObject;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTick()
|
||||
{
|
||||
|
||||
Expert.OnTick();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTimer()
|
||||
{
|
||||
|
||||
Expert.OnTimer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTrade()
|
||||
{
|
||||
|
||||
Expert.OnTrade();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTradeTransaction(const MqlTradeTransaction& trans,
|
||||
const MqlTradeRequest& request,
|
||||
const MqlTradeResult& result)
|
||||
{
|
||||
|
||||
Expert.OnTradeTransaction(trans, request, result);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
/*double OnTester()
|
||||
{
|
||||
|
||||
return(Expert.OnTester());
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTesterInit()
|
||||
{
|
||||
|
||||
Expert.OnTesterInit();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTesterPass()
|
||||
{
|
||||
|
||||
Expert.OnTesterPass();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTesterDeinit()
|
||||
{
|
||||
|
||||
Expert.OnTesterDeinit();
|
||||
return;
|
||||
|
||||
}
|
||||
*/
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnChartEvent(const int id,
|
||||
const long &lparam,
|
||||
const double &dparam,
|
||||
const string &sparam)
|
||||
{
|
||||
|
||||
Expert.OnChartEvent(id, lparam, dparam, sparam);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnBookEvent(const string &symbol)
|
||||
{
|
||||
|
||||
Expert.OnBookEvent();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
Binary file not shown.
@@ -0,0 +1,83 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| GDeaLite.mq5 |
|
||||
//| Copyright 2021, Nkondog Anselme Venceslas |
|
||||
//| https://www.mql5.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2021, Nkondog Anselme Venceslas"
|
||||
#property link "https://www.mql5.com"
|
||||
#property version "1.00"
|
||||
|
||||
#include <Nkanven\GDea\Parameters.mqh> // Description of variables
|
||||
#include <DL_ErrorHandling.mqh> // Error library
|
||||
#include <Nkanven\GDea\PreChecks.mqh> // Prechecks
|
||||
#include <Nkanven\GDea\TradingHour.mqh> //
|
||||
#include <Trade\Trade.mqh>
|
||||
#include <Nkanven\GDea\ScanPositions.mqh> // Scan for opened positions
|
||||
#include <Nkanven\GDea\CheckHistory.mqh> //Check transaction history
|
||||
#include <Nkanven\GDea\TradeManager.mqh> //Manage trade dynamic open and close conditions
|
||||
#include <Nkanven\GDea\EntriesManager.mqh> // Check buy and sell entries signals and execute them
|
||||
#include <Nkanven\GDea\LotSizeCal.mqh> // Lot size calculate
|
||||
#include <Nkanven\GDea\ClosePositions.mqh> // Close opened positions
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert initialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnInit()
|
||||
{
|
||||
//---
|
||||
|
||||
//---
|
||||
return(INIT_SUCCEEDED);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert deinitialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
//---
|
||||
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert tick function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTick()
|
||||
{
|
||||
//---
|
||||
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
|
||||
//Initialize variables
|
||||
void InitializeVariables()
|
||||
{
|
||||
IsNewCandle=false;
|
||||
IsTradedThisBar=false;
|
||||
IsOperatingHours=false;
|
||||
IsSpreadOK=false;
|
||||
|
||||
LotSize=DefaultLotSize;
|
||||
TickValue=0;
|
||||
|
||||
TotalOpenBuy=0;
|
||||
TotalOpenSell=0;
|
||||
|
||||
SignalEntry=SIGNAL_ENTRY_NEUTRAL;
|
||||
SignalExit=SIGNAL_EXIT_NEUTRAL;
|
||||
Print("Variables intialized");
|
||||
}
|
||||
|
||||
//Check and return if the spread is not too high
|
||||
void CheckSpread()
|
||||
{
|
||||
//Get the current spread in points, the (int) transforms the double coming from MarketInfo into an integer to avoid a warning when compiling
|
||||
double SpreadCurr=SymbolInfoInteger(mSymbol, SYMBOL_SPREAD);
|
||||
Print("Spread ", SpreadCurr);
|
||||
if(SpreadCurr<=MaxSpread)
|
||||
{
|
||||
IsSpreadOK=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsSpreadOK=false;
|
||||
}
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Reference in New Issue
Block a user