205 lines
4.1 KiB
Plaintext
205 lines
4.1 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Seriallize Library
|
|
// ---------------------------------------
|
|
// Name: XSignal
|
|
// Description: provides Template Signalling ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property library
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
#property strict
|
|
|
|
//
|
|
#include "../Libraries/x-saherelm.x121.support.lib.mq5"
|
|
|
|
//
|
|
bool GetLongSignal(
|
|
X121MarketConditions &conditions, // Market Conditions, Result
|
|
XSCX121Provider *analyzer // Market Analyzer
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double entry = GetEntry(
|
|
conditions.symbol,
|
|
POSITION_TYPE_BUY);
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
conditions.hasSignal = true;
|
|
|
|
//
|
|
Add(
|
|
"XTMP",
|
|
conditions.signal.providers);
|
|
|
|
//
|
|
conditions.signal.type = POSITION_TYPE_BUY;
|
|
conditions.signal.mode = X_ORDER_MODE_MARKET;
|
|
|
|
//
|
|
conditions.signal.symbol = conditions.symbol;
|
|
conditions.signal.symbol = conditions.symbol;
|
|
|
|
//
|
|
conditions.signal.r2r = 1;
|
|
conditions.signal.volume = 0.01;
|
|
conditions.signal.ignoreTP = false;
|
|
conditions.signal.ignoreSL = false;
|
|
conditions.signal.riskAmount = 0.01;
|
|
conditions.signal.calculateTP = false;
|
|
conditions.signal.useRiskAmountAsVolume = false;
|
|
conditions.signal.useSupportAndResistance = false;
|
|
|
|
//
|
|
Clean(
|
|
conditions.signal.supports);
|
|
|
|
//
|
|
double tp = 0;
|
|
double sl = 0;
|
|
|
|
//
|
|
// TODO:
|
|
// Calculate TP and SL ...
|
|
|
|
//
|
|
conditions.signal.tp = tp;
|
|
conditions.signal.sl = sl;
|
|
conditions.signal.entry = entry;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool GetShortSignal(
|
|
X121MarketConditions &conditions, // Market Conditions, Result
|
|
XSCX121Provider *analyzer // Market Analyzer
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double entry = GetEntry(
|
|
conditions.symbol,
|
|
POSITION_TYPE_SELL);
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
conditions.hasSignal = true;
|
|
|
|
//
|
|
Add(
|
|
"XTMP",
|
|
conditions.signal.providers);
|
|
|
|
//
|
|
conditions.signal.type = POSITION_TYPE_BUY;
|
|
conditions.signal.mode = X_ORDER_MODE_MARKET;
|
|
|
|
//
|
|
conditions.signal.symbol = conditions.symbol;
|
|
conditions.signal.symbol = conditions.symbol;
|
|
|
|
//
|
|
conditions.signal.r2r = 1;
|
|
conditions.signal.volume = 0.01;
|
|
conditions.signal.ignoreTP = false;
|
|
conditions.signal.ignoreSL = false;
|
|
conditions.signal.riskAmount = 0.01;
|
|
conditions.signal.calculateTP = false;
|
|
conditions.signal.useRiskAmountAsVolume = false;
|
|
conditions.signal.useSupportAndResistance = false;
|
|
|
|
//
|
|
Clean(
|
|
conditions.signal.supports);
|
|
|
|
//
|
|
double tp = 0;
|
|
double sl = 0;
|
|
|
|
//
|
|
// TODO:
|
|
// Calculate TP and SL ...
|
|
|
|
//
|
|
conditions.signal.tp = tp;
|
|
conditions.signal.sl = sl;
|
|
conditions.signal.entry = entry;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool ProcessSignal(
|
|
X121MarketConditions &conditions, // Market Conditions, Result
|
|
XSCX121Provider *analyzer // Market Analyzer
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
X121MarketConditions mConditions = analyzer.GetMarketConditions(0);
|
|
|
|
//
|
|
bool hasLong = GetLongSignal(
|
|
conditions,
|
|
analyzer);
|
|
if (hasLong)
|
|
{
|
|
//
|
|
conditions = mConditions;
|
|
return true;
|
|
}
|
|
|
|
//
|
|
bool hasShort = GetShortSignal(
|
|
mConditions,
|
|
analyzer);
|
|
if (hasShort)
|
|
{
|
|
//
|
|
conditions = mConditions;
|
|
return true;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
} |