backup all works even x121 ...
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Base Provider Inputs ...
|
||||
// class XSCBaseProviderInpts : public XSCBase
|
||||
// {
|
||||
// //
|
||||
// // Public ...
|
||||
// public:
|
||||
// //
|
||||
// // Validate Input ...
|
||||
// virtual bool IsValid();
|
||||
|
||||
// //
|
||||
// // Cleanup ...
|
||||
// virtual void Clean();
|
||||
|
||||
// //
|
||||
// // Default ...
|
||||
// virtual void Default();
|
||||
|
||||
// //
|
||||
// // Max ...
|
||||
// virtual int Max();
|
||||
// };
|
||||
|
||||
//
|
||||
// Base Market Conditions Class ...
|
||||
// class XSCBaseProviderMarketConditions : public XSCBase
|
||||
// {
|
||||
// //
|
||||
// // Public ...
|
||||
// public:
|
||||
// //
|
||||
// // Props ...
|
||||
// string symbol; // Symbol
|
||||
// ENUM_TIMEFRAMES period; // Period
|
||||
// datetime time; // Time
|
||||
|
||||
// //
|
||||
// XOHCL bars[]; // Number of Bars ...
|
||||
|
||||
// //
|
||||
// // Buffers ...
|
||||
|
||||
// //
|
||||
// // Conditions ...
|
||||
|
||||
// //
|
||||
// // Generate Score ...
|
||||
// virtual void GenerateScore(
|
||||
// double &bullishScore, // Bullish Score
|
||||
// double &bearishScore, // Bearish Score
|
||||
// double multiplier = 1 // Score Multiplier
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Generate Summary ...
|
||||
// virtual string GenerateSummary(
|
||||
// const bool onlySummary = false, // Only Generate Conditions Summary
|
||||
// double multiplier = 1, // Score Multiplier
|
||||
// const string separator = "\n", // Separator
|
||||
// const bool ignoreFalseConditions = true // Ignore False Conditions
|
||||
// );
|
||||
// };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// Class Implementation Method ...
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Inheritance ...
|
||||
|
||||
//
|
||||
// Init all Requirements ...
|
||||
// virtual bool Init(XSCBaseProviderInpts &inputs);
|
||||
|
||||
//
|
||||
// Get Inputs ...
|
||||
// virtual void GetInputs(XSCBaseProviderInpts &inputs);
|
||||
|
||||
//
|
||||
// Set Inputs and Reinitial ...
|
||||
// virtual bool setInputs(XSCBaseProviderInpts &inputs);
|
||||
|
||||
//
|
||||
// virtual void GetMarketConditions(
|
||||
// XSCBaseProviderMarketConditions &conditions, // Market Conditions Result
|
||||
// int barIndex = 0 // Specified Bar Index
|
||||
// );
|
||||
|
||||
//
|
||||
// Check Market For Signal ...
|
||||
// virtual bool HasSignal(
|
||||
// int barIndex,
|
||||
// XSignal &signal, // Hold's Signal if Exists ...
|
||||
// XSCBaseProviderMarketConditions &conditions // Hold's Market Conditions ...
|
||||
// );
|
||||
@@ -0,0 +1 @@
|
||||
type *.x121.log > Signals.x121.log
|
||||
@@ -0,0 +1,191 @@
|
||||
//
|
||||
// Check Conditions For Signal ...
|
||||
bool HasSignal(
|
||||
XSignal &signal //
|
||||
) override
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
signal.Clean();
|
||||
|
||||
//
|
||||
double sl = 0;
|
||||
double tp = 0;
|
||||
double risk = 0;
|
||||
double entry = 0;
|
||||
double reward = 0;
|
||||
double r2r = R2R();
|
||||
ENUM_POSITION_TYPE type;
|
||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||
|
||||
//
|
||||
// Check Signalling Direction ...
|
||||
result = mSignallingDirection != X_SIGNALLING_NONE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions Exists ...
|
||||
result = HasRequirements();
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
// Prepare Conditions ...
|
||||
result = PrepareRequirements();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Implement Signalling Conditions ...
|
||||
XOHCL cBar;
|
||||
result = cBar.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Analyzing Period Contains a Trend or not ...
|
||||
|
||||
//
|
||||
// Detecting Trend ...
|
||||
bool isInBullishTrend = false;
|
||||
bool isInBearishTrend = false;
|
||||
|
||||
//
|
||||
isInBullishTrend = bar.HasBullishTrend(
|
||||
highSwingBars,
|
||||
lowSwingBars //
|
||||
);
|
||||
if (!isInBullishTrend)
|
||||
{
|
||||
//
|
||||
isInBearishTrend = bar.HasBearishTrend(
|
||||
highSwingBars,
|
||||
lowSwingBars //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Only Looks For Signals if aTrend Detected ...
|
||||
result = isInBullishTrend || isInBearishTrend;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Here We have to Decide Trend or Reversal Act ...
|
||||
|
||||
//
|
||||
// Check Trend Direction Signal ...
|
||||
if (mSignallingDirection == X_SIGNALLING_BOTH_DIRECTIONS ||
|
||||
mSignallingDirection == X_SIGNALLING_TREND_DIRECTION)
|
||||
{
|
||||
//
|
||||
if (isInBullishTrend)
|
||||
{
|
||||
//
|
||||
// Find Long Signals ...
|
||||
// since we are in Bullish Trend and
|
||||
// we must do Trend Trading ...
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
false
|
||||
//
|
||||
;
|
||||
}
|
||||
else if (isInBearishTrend)
|
||||
{
|
||||
//
|
||||
// Find Short Signals ...
|
||||
// since we are in Bearish Trend and
|
||||
// we must do Trend Trading ...
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
false
|
||||
//
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check Trend Reversal Direction Signal ...
|
||||
if (!result &&
|
||||
(mSignallingDirection == X_SIGNALLING_BOTH_DIRECTIONS ||
|
||||
mSignallingDirection == X_SIGNALIING_TREND_REVERSAL_DIRECTION))
|
||||
{
|
||||
//
|
||||
if (isInBullishTrend)
|
||||
{
|
||||
//
|
||||
// Find Short Signals ...
|
||||
// since we are in Bullish Trend and
|
||||
// we must do Trend Reversal Trading ...
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
false
|
||||
//
|
||||
;
|
||||
}
|
||||
else if (isInBearishTrend)
|
||||
{
|
||||
//
|
||||
// Find Long Signals ...
|
||||
// since we are in Bearish Trend and
|
||||
// we must do Trend Reversal Trading ...
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
false
|
||||
//
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Make Sure Signal Exists ...
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
CalculateTPSLBtPrice(
|
||||
sl,
|
||||
tp,
|
||||
type,
|
||||
entry,
|
||||
r2r //
|
||||
);
|
||||
|
||||
//
|
||||
result = signal.Prepare(
|
||||
mSymbol,
|
||||
GetTag(),
|
||||
mPeriod,
|
||||
type,
|
||||
mode,
|
||||
entry,
|
||||
mVolume,
|
||||
sl,
|
||||
tp //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user