backup x121 setup ...
This commit is contained in:
@@ -0,0 +1,245 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// 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"
|
||||
#include "../Libraries/x-saherelm.draw.lib.mq5"
|
||||
|
||||
//
|
||||
bool XTMPGetLongSignal(
|
||||
X121MarketConditions &conditions, // Market Conditions, Result
|
||||
XSCX121Provider *analyzer // Market Analyzer
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
double entry = GetEntry(
|
||||
conditions.symbol,
|
||||
POSITION_TYPE_BUY);
|
||||
|
||||
//
|
||||
// XCHE Breakout ...
|
||||
|
||||
//
|
||||
double ll5 = GetLowestLow(
|
||||
conditions.symbol,
|
||||
conditions.period,
|
||||
5,
|
||||
0);
|
||||
|
||||
//
|
||||
bool isXCHELongExitsExists =
|
||||
//
|
||||
conditions.xcheInfo.le1[1] != EMPTY_VALUE &&
|
||||
conditions.xcheInfo.le2[1] != EMPTY_VALUE
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isXCHELongSign =
|
||||
//
|
||||
conditions.xcheInfo.le1[2] != EMPTY_VALUE &&
|
||||
conditions.xcheInfo.le2[2] == EMPTY_VALUE &&
|
||||
//
|
||||
isXCHELongExitsExists &&
|
||||
//
|
||||
!(ll5 > conditions.xcheInfo.le1[1] ||
|
||||
ll5 > conditions.xcheInfo.le1[2])
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isCandleBullish =
|
||||
//
|
||||
IsBullishCandle(conditions.candles[1])
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
isXCHELongSign &&
|
||||
isCandleBullish
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
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.period = conditions.period;
|
||||
|
||||
//
|
||||
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 XTMPGetShortSignal(
|
||||
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.period = conditions.period;
|
||||
|
||||
//
|
||||
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 XTMPProcessSignal(
|
||||
X121MarketConditions &conditions, // Market Conditions, Result
|
||||
XSCX121Provider *analyzer // Market Analyzer
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
X121MarketConditions mConditions = analyzer.GetMarketConditions(0);
|
||||
|
||||
//
|
||||
bool hasLong = XTMPGetLongSignal(
|
||||
mConditions,
|
||||
analyzer);
|
||||
if (hasLong)
|
||||
{
|
||||
//
|
||||
conditions = mConditions;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
bool hasShort = XTMPGetShortSignal(
|
||||
mConditions,
|
||||
analyzer);
|
||||
if (hasShort)
|
||||
{
|
||||
//
|
||||
conditions = mConditions;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user