This commit is contained in:
2024-06-23 12:20:48 +03:30
parent 96c154701c
commit 96f22dbc75
6 changed files with 669 additions and 452 deletions
+67
View File
@@ -0,0 +1,67 @@
//+------------------------------------------------------------------+
//| YMA.mq5 |
//| Yuriy Tokman |
//| http://ytg.com.ua |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link "http://ytg.com.ua"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_width1 2
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrDarkViolet
//--- input parameters
input int YMA_Period=21; // Period
//--- indicator buffers
double Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0,Buffer);
IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,YMA_Period);
string short_name="YMA";
IndicatorSetString(INDICATOR_SHORTNAME,short_name+"("+string(YMA_Period)+")");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//----
int i,limit;
//--- check for rates
if(rates_total<YMA_Period) return(0);
//--- preliminary calculations
if(prev_calculated==0)limit=YMA_Period;
else limit=prev_calculated-1;
//--- the main loop of calculations
for(i=limit;i<rates_total && !IsStopped();i++)
{
double res =0;
for(int j=i;j>i-YMA_Period && j>0;j--)
{
res += (close[j]+open[j]+high[j]+low[j])/4;
}
Buffer[i]=res/YMA_Period;
}
//----
return(rates_total);
}
//+------------------------------------------------------------------+
+219
View File
@@ -3386,3 +3386,222 @@
}
}
}
////////////////////////////////////////////////////////////////////////////////
//
// Handle Creating a new Signal Info ...
// XSignal signal;
// X121SetupConditions otherConditions[];
// if (hHasSignal)
// {
// //
// signal = hSignal;
// //
// AddRef(
// cConditions,
// otherConditions //
// );
// AddRef(
// sConditions,
// otherConditions //
// );
// }
// else if (lHasSignal)
// {
// //
// signal = lSignal;
// //
// AddRef(
// cConditions,
// otherConditions //
// );
// AddRef(
// sConditions,
// otherConditions //
// );
// AddRef(
// mConditions,
// otherConditions //
// );
// }
// else if (mHasSignal)
// {
// //
// signal = mSignal;
// //
// AddRef(
// cConditions,
// otherConditions //
// );
// AddRef(
// sConditions,
// otherConditions //
// );
// }
// else if (sHasSignal)
// {
// //
// signal = sSignal;
// //
// AddRef(
// cConditions,
// otherConditions //
// );
// AddRef(
// mConditions,
// otherConditions //
// );
// AddRef(
// lConditions,
// otherConditions //
// );
// AddRef(
// hConditions,
// otherConditions //
// );
// }
// else if (cHasSignal)
// {
// //
// signal = cSignal;
// //
// AddRef(
// sConditions,
// otherConditions //
// );
// AddRef(
// mConditions,
// otherConditions //
// );
// AddRef(
// lConditions,
// otherConditions //
// );
// AddRef(
// hConditions,
// otherConditions //
// );
// }
// //
// int pushers = cPusher + sPusher + mPusher + lPusher + hPusher;
// //
// bool isLong = IsLong(signal.type);
// //
// // Collecting Bullish/Bearish Signs ...
// if (isLong)
// {
// mBullishSigns += pushers;
// }
// else
// {
// mBearishSigns += pushers;
// }
// //
// // Validate Signal ...
// bool isValid =
// //
// // Handle Pusher Validations ...
// (mReuiredSignalVerifications <= 0
// ? true
// : pushers >= mReuiredSignalVerifications)
// //
// &&
// //
// // Handle Other Conditions Validations ...
// (!mGetVerificationFromOtherTimeFrames
// ? true
// : isLong
// ? signalGenerator.HasLongVerifications(otherConditions)
// : signalGenerator.HasShortVerifications(otherConditions))
// //
// ;
// //
// bool forceState = ForceState();
// //
// if (!isValid || (forceState && isValid))
// {
// //
// // Clear Other Conditions ...
// Clean(otherConditions);
// //
// // Fill All Conditions to Other Conditions ...
// AddRef(
// cConditions,
// otherConditions //
// );
// AddRef(
// sConditions,
// otherConditions //
// );
// AddRef(
// mConditions,
// otherConditions //
// );
// AddRef(
// lConditions,
// otherConditions //
// );
// AddRef(
// hConditions,
// otherConditions //
// );
// //
// // If Recieved Any Unverified Signal
// // we Passed it to EQM Manager ...
// EQMHandleInvalidSignal(
// signal,
// pushers,
// mVolumeOSC,
// mBullishScore,
// mBullishSigns,
// mBearishScore,
// mBearishSigns,
// otherConditions,
// isValid //
// );
// continue;
// }
// //
// if (!forceState)
// {
// //
// // Add Signal to Execution Result ...
// AddRef(
// signal,
// signals //
// );
// //
// // Add new Signal Info ...
// mTradeHandler.Add(
// signal,
// pushers,
// mVolumeOSC,
// mBullishSigns,
// mBearishSigns,
// mBullishScore,
// mBearishScore,
// cConditions,
// sConditions,
// mConditions,
// lConditions,
// hConditions //
// );
// }