last works ...
This commit is contained in:
@@ -94962,8 +94962,15 @@ private:
|
||||
|
||||
//
|
||||
// Model Provider Descriptor ...
|
||||
struct X5ProvierDescriptor
|
||||
struct X5ProviderDescriptor
|
||||
{
|
||||
//
|
||||
string symbol; // Trading Symbol
|
||||
ENUM_TIMEFRAMES period; // Trading Timeframe
|
||||
bool allowLong = true; // Allow Long Signals
|
||||
bool allowShort = true; // Allow Short Signals
|
||||
ENUM_X5_SIGNAL_PROVIDERS signallers[]; // Allowed Signal Providers
|
||||
|
||||
//
|
||||
X5ProviderInputs inputs;
|
||||
XSCX5Provider *provider;
|
||||
@@ -94975,6 +94982,127 @@ struct X5ProvierDescriptor
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
//
|
||||
bool Init()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = this.Init(
|
||||
this.symbol,
|
||||
this.period,
|
||||
this.signallers,
|
||||
this.allowLong,
|
||||
this.allowShort //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool Init(
|
||||
ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers
|
||||
bool mAllowLong = true, // Allow Long Signals
|
||||
bool mAllowShort = true // Allow Short Signals
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = this.Init(
|
||||
this.symbol,
|
||||
this.period,
|
||||
mSignallers,
|
||||
mAllowLong,
|
||||
mAllowShort //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool Init(
|
||||
string mSymbol, // Trading Symbol
|
||||
ENUM_TIMEFRAMES mPeriod, // Trading Timeframe
|
||||
ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers
|
||||
bool mAllowLong = true, // Allow Long Signals
|
||||
bool mAllowShort = true // Allow Short Signals
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
inputs.IsValid() &&
|
||||
IsValid(mSymbol) &&
|
||||
IsValid(mPeriod) &&
|
||||
(allowLong || allowShort) &&
|
||||
ArraySize(mSignallers) > 0
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
this.symbol = mSymbol;
|
||||
this.period = mPeriod;
|
||||
this.allowLong = mAllowLong;
|
||||
this.allowShort = mAllowShort;
|
||||
Copy(
|
||||
this.signallers,
|
||||
mSignallers //
|
||||
);
|
||||
|
||||
//
|
||||
// Instantiate Provider ...
|
||||
provider = new XSCX5Provider(
|
||||
this.symbol,
|
||||
this.period //
|
||||
);
|
||||
|
||||
//
|
||||
// Set Long/Short State ...
|
||||
|
||||
//
|
||||
provider
|
||||
.SetSignalTypeState(
|
||||
POSITION_TYPE_BUY,
|
||||
this.allowLong //
|
||||
);
|
||||
|
||||
//
|
||||
provider
|
||||
.SetSignalTypeState(
|
||||
POSITION_TYPE_SELL,
|
||||
this.allowShort //
|
||||
);
|
||||
|
||||
//
|
||||
// Enable Required Signallers ...
|
||||
provider
|
||||
.SetSignalProviderStates(
|
||||
this.signallers,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
// Now Must to Initialize Provider ...
|
||||
result = provider.Init(
|
||||
this.inputs //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup ...
|
||||
void Clean()
|
||||
@@ -94984,6 +95112,30 @@ struct X5ProvierDescriptor
|
||||
conditions.Clear();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool IsValid(bool validateInputs = true)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValid(symbol) &&
|
||||
IsValid(period) &&
|
||||
(validateInputs
|
||||
? inputs.IsValid()
|
||||
: true) &&
|
||||
(allowLong || allowShort) &&
|
||||
ArraySize(signallers) > 0
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Signal ...
|
||||
bool HasSignal(int barIndex = 0)
|
||||
|
||||
Reference in New Issue
Block a user