/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Indicator // ------------------------------------------------- // Name: XCHICH // Description: Ichimoku Kinko Hyo on Cycles ... // // // Maintainer: // ------------ // Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) // ////////////////////////////////////////////////////// // // Global Properties ... #property copyright "Copyright 2023, SaherElm IT Center" #property link "https://saherelm.ir" #property version "1.00" #property description "SaherElm XCHICH Indicator" #property strict // #define ShortName "XCHICH" // // Includes Common Library ... #include "../Libraries/x-saherelm.common.lib.mq5" // // Ichimoku Lines Calculator Mode ... enum ENUM_X_ICHIMOKU_CALCULATION_MODE { // X_XICH_HH_LL_MODE = 1, // Highest High and Lowest Low X_XICH_HO_LC_MODE = 2, // Highest Open and Lowest Close }; // // Inputs ... // input group "Market"; // // TENKANSEN ... input group "Tenkan Sen"; input int tenkanSenLength = 9; // Length input ENUM_X_ICHIMOKU_CALCULATION_MODE tenkanSenMode = X_XICH_HH_LL_MODE; // Calculation Mode // // KIJUNSEN ... input group "Kijun Sen"; input int kijunSenLength = 26; // Length input ENUM_X_ICHIMOKU_CALCULATION_MODE kijunSenMode = X_XICH_HH_LL_MODE; // Calculation Mode // // SENKOUSPANB ... input group "Senkou Span B"; input int senkouSpanBLength = 52; // Length input ENUM_X_ICHIMOKU_CALCULATION_MODE senkouSpanBMode = X_XICH_HH_LL_MODE; // Calculation Mode // // CHIKOUSPAN ... input group "Chikou Span"; input ENUM_APPLIED_PRICE chikuoSpanAppliedTo = PRICE_CLOSE; // Price Type // input group "Cycles"; // input group "Short"; input ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period input ENUM_TIMEFRAMES scPeriod = NULL; // Time Period // input group "Medium"; input ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Period input ENUM_TIMEFRAMES mcPeriod = NULL; // Time Period // input group "Long"; input ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Period input ENUM_TIMEFRAMES lcPeriod = NULL; // Time Period // input group "Hind"; input ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Period input ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period // input group "Presentation"; // input bool showTenkanSen = true; // Show Tenkan Sen input bool showKijunSen = true; // Show Kijun Sen input bool showChikouSpan = true; // Show Chikou Span input bool showSenkouSpanA = true; // Show Senkou Span A input bool showSenkouSpanB = true; // Show Senkou Span B input bool showKumo = true; // Show Kumo input bool shiftKumo = true; // Shift Kumo to Future // input bool showCurrent = true; // Show Current Cycle input bool showShort = true; // Show Short Cycle input bool showMedium = true; // Show Medium Cycle input bool showLong = true; // Show Long Cycle input bool showHind = true; // Show Hind Cycle // // Buffers ... // #define hideColorIDX 0 #define bullishColorIDX 1 #define bearishColorIDX 2 // #property indicator_chart_window // #property indicator_buffers 40 #property indicator_plots 30 // // CURRENT ... // #define cTenBufferIndex 0 double cTenBuffer[]; // #property indicator_label1 "XICH C TK" #property indicator_type1 DRAW_LINE #property indicator_color1 clrBrown #property indicator_style1 STYLE_SOLID #property indicator_width1 1 // #define cKijBufferIndex 1 double cKijBuffer[]; // #property indicator_label2 "XICH C KJ" #property indicator_type2 DRAW_LINE #property indicator_color2 clrDodgerBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 1 // #define cChikBufferIndex 2 double cChikBuffer[]; // #property indicator_label3 "XICH C CS" #property indicator_type3 DRAW_LINE #property indicator_color3 clrDarkGreen #property indicator_style3 STYLE_SOLID #property indicator_width3 1 // #define cSSABufferIndex 3 double cSSABuffer[]; // #property indicator_label4 "XICH C SSA" #property indicator_type4 DRAW_LINE #property indicator_color4 clrLightGray #property indicator_style4 STYLE_DASHDOTDOT #property indicator_width4 1 // #define cSSBBufferIndex 4 double cSSBBuffer[]; // #property indicator_label5 "XICH C SSB" #property indicator_type5 DRAW_LINE #property indicator_color5 clrLightGray #property indicator_style5 STYLE_DASHDOTDOT #property indicator_width5 1 // // SHORT ... // #define sTenBufferIndex 5 double sTenBuffer[]; // #property indicator_label6 "XICH S TK" #property indicator_type6 DRAW_LINE #property indicator_color6 clrBrown #property indicator_style6 STYLE_SOLID #property indicator_width6 1 // #define sKijBufferIndex 6 double sKijBuffer[]; // #property indicator_label7 "XICH S KJ" #property indicator_type7 DRAW_LINE #property indicator_color7 clrDodgerBlue #property indicator_style7 STYLE_SOLID #property indicator_width7 1 // #define sChikBufferIndex 7 double sChikBuffer[]; // #property indicator_label8 "XICH S CS" #property indicator_type8 DRAW_LINE #property indicator_color8 clrDarkGreen #property indicator_style8 STYLE_SOLID #property indicator_width8 1 // #define sSSABufferIndex 8 double sSSABuffer[]; // #property indicator_label9 "XICH S SSA" #property indicator_type9 DRAW_LINE #property indicator_color9 clrLightGray #property indicator_style9 STYLE_DASHDOTDOT #property indicator_width9 1 // #define sSSBBufferIndex 9 double sSSBBuffer[]; // #property indicator_label10 "XICH S SSB" #property indicator_type10 DRAW_LINE #property indicator_color10 clrLightGray #property indicator_style10 STYLE_DASHDOTDOT #property indicator_width10 1 // // MEDIUM ... // #define mTenBufferIndex 10 double mTenBuffer[]; // #property indicator_label11 "XICH M TK" #property indicator_type11 DRAW_LINE #property indicator_color11 clrBrown #property indicator_style11 STYLE_SOLID #property indicator_width11 1 // #define mKijBufferIndex 11 double mKijBuffer[]; // #property indicator_label12 "XICH M KJ" #property indicator_type12 DRAW_LINE #property indicator_color12 clrDodgerBlue #property indicator_style12 STYLE_SOLID #property indicator_width12 1 // #define mChikBufferIndex 12 double mChikBuffer[]; // #property indicator_label13 "XICH M CS" #property indicator_type13 DRAW_LINE #property indicator_color13 clrDarkGreen #property indicator_style13 STYLE_SOLID #property indicator_width13 1 // #define mSSABufferIndex 13 double mSSABuffer[]; // #property indicator_label14 "XICH M SSA" #property indicator_type14 DRAW_LINE #property indicator_color14 clrLightGray #property indicator_style14 STYLE_DASHDOTDOT #property indicator_width14 1 // #define mSSBBufferIndex 14 double mSSBBuffer[]; // #property indicator_label15 "XICH M SSB" #property indicator_type15 DRAW_LINE #property indicator_color15 clrLightGray #property indicator_style15 STYLE_DASHDOTDOT #property indicator_width15 1 // // LONG ... // #define lTenBufferIndex 15 double lTenBuffer[]; // #property indicator_label16 "XICH L TK" #property indicator_type16 DRAW_LINE #property indicator_color16 clrBrown #property indicator_style16 STYLE_SOLID #property indicator_width16 1 // #define lKijBufferIndex 16 double lKijBuffer[]; // #property indicator_label17 "XICH L KJ" #property indicator_type17 DRAW_LINE #property indicator_color17 clrDodgerBlue #property indicator_style17 STYLE_SOLID #property indicator_width17 1 // #define lChikBufferIndex 17 double lChikBuffer[]; // #property indicator_label18 "XICH L CS" #property indicator_type18 DRAW_LINE #property indicator_color18 clrDarkGreen #property indicator_style18 STYLE_SOLID #property indicator_width18 1 // #define lSSABufferIndex 18 double lSSABuffer[]; // #property indicator_label19 "XICH L SSA" #property indicator_type19 DRAW_LINE #property indicator_color19 clrLightGray #property indicator_style19 STYLE_DASHDOTDOT #property indicator_width19 1 // #define lSSBBufferIndex 19 double lSSBBuffer[]; // #property indicator_label20 "XICH L SSB" #property indicator_type20 DRAW_LINE #property indicator_color20 clrLightGray #property indicator_style20 STYLE_DASHDOTDOT #property indicator_width20 1 // // HIND ... // #define hTenBufferIndex 20 double hTenBuffer[]; // #property indicator_label21 "XICH H TK" #property indicator_type21 DRAW_LINE #property indicator_color21 clrBrown #property indicator_style21 STYLE_SOLID #property indicator_width21 1 // #define hKijBufferIndex 21 double hKijBuffer[]; // #property indicator_label22 "XICH H KJ" #property indicator_type22 DRAW_LINE #property indicator_color22 clrDodgerBlue #property indicator_style22 STYLE_SOLID #property indicator_width22 1 // #define hChikBufferIndex 22 double hChikBuffer[]; // #property indicator_label23 "XICH H CS" #property indicator_type23 DRAW_LINE #property indicator_color23 clrDarkGreen #property indicator_style23 STYLE_SOLID #property indicator_width23 1 // #define hSSABufferIndex 23 double hSSABuffer[]; // #property indicator_label24 "XICH H SSA" #property indicator_type24 DRAW_LINE #property indicator_color24 clrLightGray #property indicator_style24 STYLE_DASHDOTDOT #property indicator_width24 1 // #define hSSBBufferIndex 24 double hSSBBuffer[]; // #property indicator_label25 "XICH H SSB" #property indicator_type25 DRAW_LINE #property indicator_color25 clrLightGray #property indicator_style25 STYLE_DASHDOTDOT #property indicator_width25 1 // // // // // CURRENT ... // #define cSSAKCBufferIndex 25 double cSSAKCBuffer[]; // #define cSSBKCBufferIndex 26 double cSSBKCBuffer[]; // // CLOUD ... // #define cKCBufferIndex 25 // #property indicator_label26 "XICH C Kumo" #property indicator_type26 DRAW_FILLING #property indicator_color26 clrAqua, clrMagenta #property indicator_style26 STYLE_SOLID #property indicator_width26 1 // // SHORT ... // #define sSSAKCBufferIndex 27 double sSSAKCBuffer[]; // #define sSSBKCBufferIndex 28 double sSSBKCBuffer[]; // // CLOUD ... // #define sKCBufferIndex 26 // #property indicator_label27 "XICH S Kumo" #property indicator_type27 DRAW_FILLING #property indicator_color27 clrAqua, clrMagenta #property indicator_style27 STYLE_SOLID #property indicator_width27 1 // // MEDIUM ... // #define mSSAKCBufferIndex 29 double mSSAKCBuffer[]; // #define mSSBKCBufferIndex 30 double mSSBKCBuffer[]; // // CLOUD ... // #define mKCBufferIndex 27 // #property indicator_label28 "XICH M Kumo" #property indicator_type28 DRAW_FILLING #property indicator_color28 clrAqua, clrMagenta #property indicator_style28 STYLE_SOLID #property indicator_width28 1 // // LONG ... // #define lSSAKCBufferIndex 31 double lSSAKCBuffer[]; // #define lSSBKCBufferIndex 32 double lSSBKCBuffer[]; // // CLOUD ... // #define lKCBufferIndex 28 // #property indicator_label29 "XICH L Kumo" #property indicator_type29 DRAW_FILLING #property indicator_color29 clrAqua, clrMagenta #property indicator_style29 STYLE_SOLID #property indicator_width29 1 // // HIND ... // #define hSSAKCBufferIndex 33 double hSSAKCBuffer[]; // #define hSSBKCBufferIndex 34 double hSSBKCBuffer[]; // // CLOUD ... // #define hKCBufferIndex 29 // #property indicator_label30 "XICH H Kumo" #property indicator_type30 DRAW_FILLING #property indicator_color30 clrAqua, clrMagenta #property indicator_style30 STYLE_SOLID #property indicator_width30 1 // // Variables, Properties and etc ... // int maxLength; // // Current ... int mCTenkanSenLength = tenkanSenLength; int mCKijunSenLength = kijunSenLength; int mCSenkouSpanBLength = senkouSpanBLength; // // Short ... int mSCycleLength = 0; int mSTenkanSenLength = 0; int mSKijunSenLength = 0; int mSSenkouSpanBLength = 0; ENUM_TIMEFRAMES mSCPeriod = NULL; // // Medium ... int mMCycleLength = 0; int mMTenkanSenLength = 0; int mMKijunSenLength = 0; int mMSenkouSpanBLength = 0; ENUM_TIMEFRAMES mMCPeriod = NULL; // // Long ... int mLCycleLength = 0; int mLTenkanSenLength = 0; int mLKijunSenLength = 0; int mLSenkouSpanBLength = 0; ENUM_TIMEFRAMES mLCPeriod = NULL; // // Hind ... int mHCycleLength = 0; int mHTenkanSenLength = 0; int mHKijunSenLength = 0; int mHSenkouSpanBLength = 0; ENUM_TIMEFRAMES mHCPeriod = NULL; // ENUM_SERIESMODE mTenkanSenTopMode = NULL; ENUM_SERIESMODE mTenkanSenBottomMode = NULL; // ENUM_SERIESMODE mKijunSenTopMode = NULL; ENUM_SERIESMODE mKijunSenBottomMode = NULL; // ENUM_SERIESMODE mSenkouSpanBTopMode = NULL; ENUM_SERIESMODE mSenkouSpanBBottomMode = NULL; // // Event Handlers ... // // Initialization ... int OnInit() { // // Validate Inputs ... if (!ValidateInputs()) { return INIT_PARAMETERS_INCORRECT; } // if (!InitMarketCycles()) { return INIT_PARAMETERS_INCORRECT; } // // because in some cases we may have more than one input for // calculation and we must prevent any calculation // untill we pass the biggest input length, here we get max Input length // and then wait until pass it ... maxLength = ExtractMaxLengthOfInputs(); // // Define Index Buffers ... DefineBuffers(); // // Set Indicator ShortName ... SetIndicatorName(); // // Init Succeed ... return INIT_SUCCEEDED; } // // DeInitialization ... void OnDeinit(const int reason) { // // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function // REASON_REMOVE 1 Program removed from a chart // REASON_RECOMPILE 2 Program recompiled // REASON_CHARTCHANGE 3 A symbol or a chart period is changed // REASON_CHARTCLOSE 4 Chart closed // REASON_PARAMETERS 5 Inputs changed by a user // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings // REASON_TEMPLATE 7 Another chart template applied // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value // REASON_CLOSE 9 Terminal closed } // // Calculating what we want ... int OnCalculate( const int rates_total, // Total Bars on Chart ... const int prev_calculated, // Total Calculated Bars on Charts ... const datetime &time[], // History of Open Time ... const double &open[], // History of Open Price ... const double &high[], // History of High Price ... const double &low[], // History of Low Price ... const double &close[], // History of Close Price ... const long &tick_volume[], // History of Tick Volumes on Bar ... const long &volume[], // History of Trade Volumes ... const int &spread[] // History of Spread Price ... ) { // // Prepare Buffers ... ArraySetAsSeries(time, true); ArraySetAsSeries(open, true); ArraySetAsSeries(high, true); ArraySetAsSeries(low, true); ArraySetAsSeries(close, true); ArraySetAsSeries(tick_volume, true); ArraySetAsSeries(volume, true); ArraySetAsSeries(spread, true); // // this counts Available Bars ... int limit; // limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; // // Main Loop ... for (int i = limit - 1; i >= 0 && !IsStopped(); i--) { // CalculateBuffers( // i, prev_calculated, rates_total, // open, high, close, low, tick_volume // ); } // return rates_total; } // // Functions ... // // Validate Input Args for Initialization ... bool ValidateInputs() { // bool result = false; // result = // (tenkanSenLength > 2 && kijunSenLength > tenkanSenLength && senkouSpanBLength > kijunSenLength) // && // (IsValid(scMethod, scPeriod) && IsValid(mcMethod, mcPeriod) && IsValid(lcMethod, lcPeriod) && IsValid(hcMethod, hcPeriod)) // ; // return result; } // // Initialize Market Cycles ... bool InitMarketCycles() { // bool result = false; // // Current Cycle Initialization ... // int cPeriodSeconds = PeriodSeconds(_Period); // // Short Cycle Initialization ... // // Find Cycle Period ... if (scMethod == X_PERIOD_AUTO) { // // Select Period ... mSCPeriod = GetCyclePeriod( X_MARKET_CYCLE_SHORT, _Period // ); } else { mSCPeriod = scPeriod; } // result = IsValid(mSCPeriod); if (!result) { return result; } // mSCycleLength = PeriodSeconds(mSCPeriod) / cPeriodSeconds; mSTenkanSenLength = mSCycleLength * mCTenkanSenLength; mSKijunSenLength = mSCycleLength * mCKijunSenLength; mSSenkouSpanBLength = mSCycleLength * mCSenkouSpanBLength; result = mSCycleLength > 0; if (!result) { return result; } // // Medium Cycle Initialization ... // // Find Cycle Period ... if (mcMethod == X_PERIOD_AUTO) { // // Select Period ... mMCPeriod = GetCyclePeriod( X_MARKET_CYCLE_MEDIUM, _Period // ); } else { mMCPeriod = mcPeriod; } // result = IsValid(mMCPeriod); if (!result) { return result; } // mMCycleLength = PeriodSeconds(mMCPeriod) / cPeriodSeconds; mMTenkanSenLength = mMCycleLength * mCTenkanSenLength; mMKijunSenLength = mMCycleLength * mCKijunSenLength; mMSenkouSpanBLength = mMCycleLength * mCSenkouSpanBLength; result = mMCycleLength > 0; if (!result) { return result; } // // Long Cycle Initialization ... // // Find Cycle Period ... if (lcMethod == X_PERIOD_AUTO) { // // Select Period ... mLCPeriod = GetCyclePeriod( X_MARKET_CYCLE_LONG, _Period // ); } else { mLCPeriod = lcPeriod; } // result = IsValid(mLCPeriod); if (!result) { return result; } // mLCycleLength = PeriodSeconds(mLCPeriod) / cPeriodSeconds; mLTenkanSenLength = mLCycleLength * mCTenkanSenLength; mLKijunSenLength = mLCycleLength * mCKijunSenLength; mLSenkouSpanBLength = mLCycleLength * mCSenkouSpanBLength; result = mLCycleLength > 0; if (!result) { return result; } // // Hind Cycle Initialization ... // // Find Cycle Period ... if (hcMethod == X_PERIOD_AUTO) { // // Select Period ... mHCPeriod = GetCyclePeriod( X_MARKET_CYCLE_HIND, _Period // ); } else { mHCPeriod = hcPeriod; } // result = IsValid(mHCPeriod); if (!result) { return result; } // mHCycleLength = PeriodSeconds(mHCPeriod) / cPeriodSeconds; mHTenkanSenLength = mHCycleLength * mCTenkanSenLength; mHKijunSenLength = mHCycleLength * mCKijunSenLength; mHSenkouSpanBLength = mHCycleLength * mCSenkouSpanBLength; result = mHCycleLength > 0; if (!result) { return result; } // return result; } // // Retrieve all Exists Input Max Length ... // use for Start Of Drawing ... int ExtractMaxLengthOfInputs() { // int result = 0; // // Current ... result = MathMax(mCTenkanSenLength, mCKijunSenLength); result = MathMax(result, mCSenkouSpanBLength); // // Short ... result = MathMax(mSTenkanSenLength, mSKijunSenLength); result = MathMax(result, mSSenkouSpanBLength); // // Medium ... result = MathMax(mMTenkanSenLength, mMKijunSenLength); result = MathMax(result, mMSenkouSpanBLength); // // Long ... result = MathMax(mLTenkanSenLength, mLKijunSenLength); result = MathMax(result, mLSenkouSpanBLength); // // Hind ... result = MathMax(mHTenkanSenLength, mHKijunSenLength); result = MathMax(result, mHSenkouSpanBLength); // return result; } // // Set Indicator Short Name and also we can define Buffers Labels ... void SetIndicatorName() { // IndicatorSetString(INDICATOR_SHORTNAME, ShortName); IndicatorSetInteger(INDICATOR_DIGITS, _Digits); } // // Define Indexes and Styles ... void DefineBuffers() { // // Current ... // // TENKANSEN ... // bool canCShowTenkanSen = showTenkanSen && showCurrent; ENUM_DRAW_TYPE cTenkanSenDrawType = canCShowTenkanSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(cTenBuffer, true); SetIndexBuffer(cTenBufferIndex, cTenBuffer, INDICATOR_DATA); PlotIndexSetInteger(cTenBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(cTenBufferIndex, PLOT_SHOW_DATA, canCShowTenkanSen); PlotIndexSetInteger(cTenBufferIndex, PLOT_DRAW_TYPE, cTenkanSenDrawType); // // KIJUNSEN ... // bool canCShowKijunSen = showKijunSen && showCurrent; ENUM_DRAW_TYPE cKijunSenDrawType = canCShowKijunSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(cKijBuffer, true); SetIndexBuffer(cKijBufferIndex, cKijBuffer, INDICATOR_DATA); PlotIndexSetInteger(cKijBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(cKijBufferIndex, PLOT_SHOW_DATA, canCShowKijunSen); PlotIndexSetInteger(cKijBufferIndex, PLOT_DRAW_TYPE, cKijunSenDrawType); // // CHIKOUSPAN ... // bool canCShowChikouSpan = showChikouSpan && showCurrent; ENUM_DRAW_TYPE cChikouSpanDrawType = canCShowChikouSpan ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(cChikBuffer, true); SetIndexBuffer(cChikBufferIndex, cChikBuffer, INDICATOR_DATA); PlotIndexSetInteger(cChikBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(cChikBufferIndex, PLOT_SHIFT, -mCKijunSenLength); PlotIndexSetInteger(cChikBufferIndex, PLOT_SHOW_DATA, canCShowChikouSpan); PlotIndexSetInteger(cChikBufferIndex, PLOT_DRAW_TYPE, cChikouSpanDrawType); // // SENKOUSPAN A and B ... int cShiftSize = shiftKumo ? mCKijunSenLength : 0; // // SENKOUSPANA ... bool canCShowSenkouSpanA = showSenkouSpanA && showCurrent; ENUM_DRAW_TYPE cSenkouSpanADrawType = canCShowSenkouSpanA ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(cSSABuffer, true); SetIndexBuffer(cSSABufferIndex, cSSABuffer, INDICATOR_DATA); PlotIndexSetInteger(cSSABufferIndex, PLOT_SHIFT, cShiftSize); PlotIndexSetInteger(cSSABufferIndex, PLOT_SHOW_DATA, canCShowSenkouSpanA); PlotIndexSetInteger(cSSABufferIndex, PLOT_DRAW_TYPE, cSenkouSpanADrawType); // // SENKOUSPANB ... bool canCShowSenkouSpanB = showSenkouSpanB && showCurrent; ENUM_DRAW_TYPE cSenkouSpanBDrawType = canCShowSenkouSpanB ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(cSSBBuffer, true); SetIndexBuffer(cSSBBufferIndex, cSSBBuffer, INDICATOR_DATA); PlotIndexSetInteger(cSSBBufferIndex, PLOT_SHIFT, cShiftSize); PlotIndexSetInteger(cSSBBufferIndex, PLOT_SHOW_DATA, canCShowSenkouSpanB); PlotIndexSetInteger(cSSBBufferIndex, PLOT_DRAW_TYPE, cSenkouSpanBDrawType); // // Short ... // // TENKANSEN ... // bool canSShowTenkanSen = showTenkanSen && showShort; ENUM_DRAW_TYPE sTenkanSenDrawType = canSShowTenkanSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(sTenBuffer, true); SetIndexBuffer(sTenBufferIndex, sTenBuffer, INDICATOR_DATA); PlotIndexSetInteger(sTenBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(sTenBufferIndex, PLOT_SHOW_DATA, canSShowTenkanSen); PlotIndexSetInteger(sTenBufferIndex, PLOT_DRAW_TYPE, sTenkanSenDrawType); // // KIJUNSEN ... // bool canSShowKijunSen = showKijunSen && showShort; ENUM_DRAW_TYPE sKijunSenDrawType = canSShowKijunSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(sKijBuffer, true); SetIndexBuffer(sKijBufferIndex, sKijBuffer, INDICATOR_DATA); PlotIndexSetInteger(sKijBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(sKijBufferIndex, PLOT_SHOW_DATA, canSShowKijunSen); PlotIndexSetInteger(sKijBufferIndex, PLOT_DRAW_TYPE, sKijunSenDrawType); // // CHIKOUSPAN ... // bool canSShowChikouSpan = showChikouSpan && showShort; ENUM_DRAW_TYPE sChikouSpanDrawType = canSShowChikouSpan ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(sChikBuffer, true); SetIndexBuffer(sChikBufferIndex, sChikBuffer, INDICATOR_DATA); PlotIndexSetInteger(sChikBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(sChikBufferIndex, PLOT_SHIFT, -mSKijunSenLength); PlotIndexSetInteger(sChikBufferIndex, PLOT_SHOW_DATA, canSShowChikouSpan); PlotIndexSetInteger(sChikBufferIndex, PLOT_DRAW_TYPE, sChikouSpanDrawType); // // SENKOUSPAN A and B ... int sShiftSize = shiftKumo ? mSKijunSenLength : 0; // // SENKOUSPANA ... bool canSShowSenkouSpanA = showSenkouSpanA && showShort; ENUM_DRAW_TYPE sSenkouSpanADrawType = canSShowSenkouSpanA ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(sSSABuffer, true); SetIndexBuffer(sSSABufferIndex, sSSABuffer, INDICATOR_DATA); PlotIndexSetInteger(sSSABufferIndex, PLOT_SHIFT, sShiftSize); PlotIndexSetInteger(sSSABufferIndex, PLOT_SHOW_DATA, canSShowSenkouSpanA); PlotIndexSetInteger(sSSABufferIndex, PLOT_DRAW_TYPE, sSenkouSpanADrawType); // // SENKOUSPANB ... bool canSShowSenkouSpanB = showSenkouSpanB && showShort; ENUM_DRAW_TYPE sSenkouSpanBDrawType = canSShowSenkouSpanB ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(sSSBBuffer, true); SetIndexBuffer(sSSBBufferIndex, sSSBBuffer, INDICATOR_DATA); PlotIndexSetInteger(sSSBBufferIndex, PLOT_SHIFT, sShiftSize); PlotIndexSetInteger(sSSBBufferIndex, PLOT_SHOW_DATA, canSShowSenkouSpanB); PlotIndexSetInteger(sSSBBufferIndex, PLOT_DRAW_TYPE, sSenkouSpanBDrawType); // // Medium ... // // TENKANSEN ... // bool canMShowTenkanSen = showTenkanSen && showMedium; ENUM_DRAW_TYPE mTenkanSenDrawType = canMShowTenkanSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(mTenBuffer, true); SetIndexBuffer(mTenBufferIndex, mTenBuffer, INDICATOR_DATA); PlotIndexSetInteger(mTenBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(mTenBufferIndex, PLOT_SHOW_DATA, canMShowTenkanSen); PlotIndexSetInteger(mTenBufferIndex, PLOT_DRAW_TYPE, mTenkanSenDrawType); // // KIJUNSEN ... // bool canMShowKijunSen = showKijunSen && showMedium; ENUM_DRAW_TYPE mKijunSenDrawType = canMShowKijunSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(mKijBuffer, true); SetIndexBuffer(mKijBufferIndex, mKijBuffer, INDICATOR_DATA); PlotIndexSetInteger(mKijBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(mKijBufferIndex, PLOT_SHOW_DATA, canMShowKijunSen); PlotIndexSetInteger(mKijBufferIndex, PLOT_DRAW_TYPE, mKijunSenDrawType); // // CHIKOUSPAN ... // bool canMShowChikouSpan = showChikouSpan && showMedium; ENUM_DRAW_TYPE mChikouSpanDrawType = canMShowChikouSpan ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(mChikBuffer, true); SetIndexBuffer(mChikBufferIndex, mChikBuffer, INDICATOR_DATA); PlotIndexSetInteger(mChikBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(mChikBufferIndex, PLOT_SHIFT, -mMKijunSenLength); PlotIndexSetInteger(mChikBufferIndex, PLOT_SHOW_DATA, canMShowChikouSpan); PlotIndexSetInteger(mChikBufferIndex, PLOT_DRAW_TYPE, mChikouSpanDrawType); // // SENKOUSPAN A and B ... int mShiftSize = shiftKumo ? mMKijunSenLength : 0; // // SENKOUSPANA ... bool canMShowSenkouSpanA = showSenkouSpanA && showMedium; ENUM_DRAW_TYPE mSenkouSpanADrawType = canMShowSenkouSpanA ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(mSSABuffer, true); SetIndexBuffer(mSSABufferIndex, mSSABuffer, INDICATOR_DATA); PlotIndexSetInteger(mSSABufferIndex, PLOT_SHIFT, mShiftSize); PlotIndexSetInteger(mSSABufferIndex, PLOT_SHOW_DATA, canMShowSenkouSpanA); PlotIndexSetInteger(mSSABufferIndex, PLOT_DRAW_TYPE, mSenkouSpanADrawType); // // SENKOUSPANB ... bool canMShowSenkouSpanB = showSenkouSpanB && showMedium; ENUM_DRAW_TYPE mSenkouSpanBDrawType = canMShowSenkouSpanB ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(mSSBBuffer, true); SetIndexBuffer(mSSBBufferIndex, mSSBBuffer, INDICATOR_DATA); PlotIndexSetInteger(mSSBBufferIndex, PLOT_SHIFT, mShiftSize); PlotIndexSetInteger(mSSBBufferIndex, PLOT_SHOW_DATA, canMShowSenkouSpanB); PlotIndexSetInteger(mSSBBufferIndex, PLOT_DRAW_TYPE, mSenkouSpanBDrawType); // // Long ... // // TENKANSEN ... // bool canLShowTenkanSen = showTenkanSen && showLong; ENUM_DRAW_TYPE lTenkanSenDrawType = canLShowTenkanSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(lTenBuffer, true); SetIndexBuffer(lTenBufferIndex, lTenBuffer, INDICATOR_DATA); PlotIndexSetInteger(lTenBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(lTenBufferIndex, PLOT_SHOW_DATA, canLShowTenkanSen); PlotIndexSetInteger(lTenBufferIndex, PLOT_DRAW_TYPE, lTenkanSenDrawType); // // KIJUNSEN ... // bool canLShowKijunSen = showKijunSen && showLong; ENUM_DRAW_TYPE lKijunSenDrawType = canLShowKijunSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(lKijBuffer, true); SetIndexBuffer(lKijBufferIndex, lKijBuffer, INDICATOR_DATA); PlotIndexSetInteger(lKijBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(lKijBufferIndex, PLOT_SHOW_DATA, canLShowKijunSen); PlotIndexSetInteger(lKijBufferIndex, PLOT_DRAW_TYPE, lKijunSenDrawType); // // CHIKOUSPAN ... // bool canLShowChikouSpan = showChikouSpan && showLong; ENUM_DRAW_TYPE lChikouSpanDrawType = canLShowChikouSpan ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(lChikBuffer, true); SetIndexBuffer(lChikBufferIndex, lChikBuffer, INDICATOR_DATA); PlotIndexSetInteger(lChikBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(lChikBufferIndex, PLOT_SHIFT, -mLKijunSenLength); PlotIndexSetInteger(lChikBufferIndex, PLOT_SHOW_DATA, canLShowChikouSpan); PlotIndexSetInteger(lChikBufferIndex, PLOT_DRAW_TYPE, lChikouSpanDrawType); // // SENKOUSPAN A and B ... int lShiftSize = shiftKumo ? mLKijunSenLength : 0; // // SENKOUSPANA ... bool canLShowSenkouSpanA = showSenkouSpanA && showLong; ENUM_DRAW_TYPE lSenkouSpanADrawType = canLShowSenkouSpanA ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(lSSABuffer, true); SetIndexBuffer(lSSABufferIndex, lSSABuffer, INDICATOR_DATA); PlotIndexSetInteger(lSSABufferIndex, PLOT_SHIFT, lShiftSize); PlotIndexSetInteger(lSSABufferIndex, PLOT_SHOW_DATA, canLShowSenkouSpanA); PlotIndexSetInteger(lSSABufferIndex, PLOT_DRAW_TYPE, lSenkouSpanADrawType); // // SENKOUSPANB ... bool canLShowSenkouSpanB = showSenkouSpanB && showLong; ENUM_DRAW_TYPE lSenkouSpanBDrawType = canLShowSenkouSpanB ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(lSSBBuffer, true); SetIndexBuffer(lSSBBufferIndex, lSSBBuffer, INDICATOR_DATA); PlotIndexSetInteger(lSSBBufferIndex, PLOT_SHIFT, lShiftSize); PlotIndexSetInteger(lSSBBufferIndex, PLOT_SHOW_DATA, canLShowSenkouSpanB); PlotIndexSetInteger(lSSBBufferIndex, PLOT_DRAW_TYPE, lSenkouSpanBDrawType); // // Hind ... // // TENKANSEN ... // bool canHShowTenkanSen = showTenkanSen && showHind; ENUM_DRAW_TYPE hTenkanSenDrawType = canHShowTenkanSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(hTenBuffer, true); SetIndexBuffer(hTenBufferIndex, hTenBuffer, INDICATOR_DATA); PlotIndexSetInteger(hTenBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(hTenBufferIndex, PLOT_SHOW_DATA, canHShowTenkanSen); PlotIndexSetInteger(hTenBufferIndex, PLOT_DRAW_TYPE, hTenkanSenDrawType); // // KIJUNSEN ... // bool canHShowKijunSen = showKijunSen && showHind; ENUM_DRAW_TYPE hKijunSenDrawType = canHShowKijunSen ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(hKijBuffer, true); SetIndexBuffer(hKijBufferIndex, hKijBuffer, INDICATOR_DATA); PlotIndexSetInteger(hKijBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(hKijBufferIndex, PLOT_SHOW_DATA, canHShowKijunSen); PlotIndexSetInteger(hKijBufferIndex, PLOT_DRAW_TYPE, hKijunSenDrawType); // // CHIKOUSPAN ... // bool canHShowChikouSpan = showChikouSpan && showHind; ENUM_DRAW_TYPE hChikouSpanDrawType = canHShowChikouSpan ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(hChikBuffer, true); SetIndexBuffer(hChikBufferIndex, hChikBuffer, INDICATOR_DATA); PlotIndexSetInteger(hChikBufferIndex, PLOT_DRAW_BEGIN, maxLength); PlotIndexSetInteger(hChikBufferIndex, PLOT_SHIFT, -mHKijunSenLength); PlotIndexSetInteger(hChikBufferIndex, PLOT_SHOW_DATA, canHShowChikouSpan); PlotIndexSetInteger(hChikBufferIndex, PLOT_DRAW_TYPE, hChikouSpanDrawType); // // SENKOUSPAN A and B ... int hShiftSize = shiftKumo ? mHKijunSenLength : 0; // // SENKOUSPANA ... bool canHShowSenkouSpanA = showSenkouSpanA && showHind; ENUM_DRAW_TYPE hSenkouSpanADrawType = canHShowSenkouSpanA ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(hSSABuffer, true); SetIndexBuffer(hSSABufferIndex, hSSABuffer, INDICATOR_DATA); PlotIndexSetInteger(hSSABufferIndex, PLOT_SHIFT, hShiftSize); PlotIndexSetInteger(hSSABufferIndex, PLOT_SHOW_DATA, canHShowSenkouSpanA); PlotIndexSetInteger(hSSABufferIndex, PLOT_DRAW_TYPE, hSenkouSpanADrawType); // // SENKOUSPANB ... bool canHShowSenkouSpanB = showSenkouSpanB && showHind; ENUM_DRAW_TYPE hSenkouSpanBDrawType = canHShowSenkouSpanB ? DRAW_LINE : DRAW_NONE; // ArraySetAsSeries(hSSBBuffer, true); SetIndexBuffer(hSSBBufferIndex, hSSBBuffer, INDICATOR_DATA); PlotIndexSetInteger(hSSBBufferIndex, PLOT_SHIFT, hShiftSize); PlotIndexSetInteger(hSSBBufferIndex, PLOT_SHOW_DATA, canHShowSenkouSpanB); PlotIndexSetInteger(hSSBBufferIndex, PLOT_DRAW_TYPE, hSenkouSpanBDrawType); // // Here we Create KUMO CLOUD Buffers ... // // int lastBufferIndex = hSSBBufferIndex; // // Current ... bool cCanShowKumo = showKumo && showCurrent; ENUM_DRAW_TYPE cKumoDrawType = cCanShowKumo ? DRAW_FILLING : DRAW_NONE; // // SENKOUSPANA ... ArraySetAsSeries(cSSAKCBuffer, true); SetIndexBuffer(cSSAKCBufferIndex, cSSAKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(cSSAKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // // SENKOUSPANB ... ArraySetAsSeries(cSSBKCBuffer, true); SetIndexBuffer(cSSBKCBufferIndex, cSSBKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(cSSBKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // PlotIndexSetInteger(cKCBufferIndex, PLOT_SHOW_DATA, false); PlotIndexSetInteger(cKCBufferIndex, PLOT_SHIFT, cShiftSize); PlotIndexSetInteger(cKCBufferIndex, PLOT_DRAW_TYPE, cKumoDrawType); // // Short ... bool sCanShowKumo = showKumo && showShort; ENUM_DRAW_TYPE sKumoDrawType = sCanShowKumo ? DRAW_FILLING : DRAW_NONE; // // SENKOUSPANA ... ArraySetAsSeries(sSSAKCBuffer, true); SetIndexBuffer(sSSAKCBufferIndex, sSSAKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(sSSAKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // // SENKOUSPANB ... ArraySetAsSeries(sSSBKCBuffer, true); SetIndexBuffer(sSSBKCBufferIndex, sSSBKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(sSSBKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // PlotIndexSetInteger(sKCBufferIndex, PLOT_SHOW_DATA, false); PlotIndexSetInteger(sKCBufferIndex, PLOT_SHIFT, sShiftSize); PlotIndexSetInteger(sKCBufferIndex, PLOT_DRAW_TYPE, sKumoDrawType); // // Medium ... bool mCanShowKumo = showKumo && showMedium; ENUM_DRAW_TYPE mKumoDrawType = mCanShowKumo ? DRAW_FILLING : DRAW_NONE; // // SENKOUSPANA ... ArraySetAsSeries(mSSAKCBuffer, true); SetIndexBuffer(mSSAKCBufferIndex, mSSAKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(mSSAKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // // SENKOUSPANB ... ArraySetAsSeries(mSSBKCBuffer, true); SetIndexBuffer(mSSBKCBufferIndex, mSSBKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(mSSBKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // PlotIndexSetInteger(mKCBufferIndex, PLOT_SHOW_DATA, false); PlotIndexSetInteger(mKCBufferIndex, PLOT_SHIFT, mShiftSize); PlotIndexSetInteger(mKCBufferIndex, PLOT_DRAW_TYPE, mKumoDrawType); // // Long ... bool lCanShowKumo = showKumo && showLong; ENUM_DRAW_TYPE lKumoDrawType = lCanShowKumo ? DRAW_FILLING : DRAW_NONE; // // SENKOUSPANA ... ArraySetAsSeries(lSSAKCBuffer, true); SetIndexBuffer(lSSAKCBufferIndex, lSSAKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(lSSAKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // // SENKOUSPANB ... ArraySetAsSeries(lSSBKCBuffer, true); SetIndexBuffer(lSSBKCBufferIndex, lSSBKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(lSSBKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // PlotIndexSetInteger(lKCBufferIndex, PLOT_SHOW_DATA, false); PlotIndexSetInteger(lKCBufferIndex, PLOT_SHIFT, lShiftSize); PlotIndexSetInteger(lKCBufferIndex, PLOT_DRAW_TYPE, lKumoDrawType); // // Hind ... bool hCanShowKumo = showKumo && showHind; ENUM_DRAW_TYPE hKumoDrawType = hCanShowKumo ? DRAW_FILLING : DRAW_NONE; // // SENKOUSPANA ... ArraySetAsSeries(hSSAKCBuffer, true); SetIndexBuffer(hSSAKCBufferIndex, hSSAKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(hSSAKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // // SENKOUSPANB ... ArraySetAsSeries(hSSBKCBuffer, true); SetIndexBuffer(hSSBKCBufferIndex, hSSBKCBuffer, INDICATOR_DATA); PlotIndexSetInteger(hSSBKCBufferIndex, PLOT_DRAW_BEGIN, maxLength); // PlotIndexSetInteger(hKCBufferIndex, PLOT_SHOW_DATA, false); PlotIndexSetInteger(hKCBufferIndex, PLOT_SHIFT, hShiftSize); PlotIndexSetInteger(hKCBufferIndex, PLOT_DRAW_TYPE, hKumoDrawType); } // // Calculations ... // // Calculate Buffers ... void CalculateBuffers( int bar_index, // Selected Bar Index const int prevCalculated, const int ratesTotal, const double &open[], const double &high[], const double &close[], const double &low[], const long &tickVolume[] // ) { // CalculateCycles( bar_index, prevCalculated, ratesTotal, open, high, close, low, tickVolume // ); } // void CalculateCycles( int bar_index, // Selected Bar Index const int prevCalculated, const int ratesTotal, const double &open[], const double &high[], const double &close[], const double &low[], const long &tickVolume[] // ) { // // CURRENT ... CalculateCycle( // bar_index, prevCalculated, ratesTotal, // open, high, close, low, tickVolume, // mCTenkanSenLength, mCKijunSenLength, mCSenkouSpanBLength, // cTenBuffer, cKijBuffer, cChikBuffer, cSSABuffer, cSSBBuffer, cSSAKCBuffer, cSSBKCBuffer // ); // // SHORT ... CalculateCycle( // bar_index, prevCalculated, ratesTotal, // open, high, close, low, tickVolume, // mSTenkanSenLength, mSKijunSenLength, mSSenkouSpanBLength, // sTenBuffer, sKijBuffer, sChikBuffer, sSSABuffer, sSSBBuffer, sSSAKCBuffer, sSSBKCBuffer // ); // // MEDIUM ... CalculateCycle( // bar_index, prevCalculated, ratesTotal, // open, high, close, low, tickVolume, // mMTenkanSenLength, mMKijunSenLength, mMSenkouSpanBLength, // mTenBuffer, mKijBuffer, mChikBuffer, mSSABuffer, mSSBBuffer, mSSAKCBuffer, mSSBKCBuffer // ); // // LONG ... CalculateCycle( // bar_index, prevCalculated, ratesTotal, // open, high, close, low, tickVolume, // mLTenkanSenLength, mLKijunSenLength, mLSenkouSpanBLength, // lTenBuffer, lKijBuffer, lChikBuffer, lSSABuffer, lSSBBuffer, lSSAKCBuffer, lSSBKCBuffer // ); // // HIND ... CalculateCycle( // bar_index, prevCalculated, ratesTotal, // open, high, close, low, tickVolume, // mHTenkanSenLength, mHKijunSenLength, mHSenkouSpanBLength, // hTenBuffer, hKijBuffer, hChikBuffer, hSSABuffer, hSSBBuffer, hSSAKCBuffer, hSSBKCBuffer // ); } // void CalculateCycle( int bar_index, // Selected Bar Index const int prevCalculated, const int ratesTotal, const double &open[], const double &high[], const double &close[], const double &low[], const long &tickVolume[], // int _tenkanSenLength, int _kijunSenLength, int _senkouSpanBLength, // double &_tenkanSenBuffer[], double &_kijunSenBuffer[], double &_chikouSpanBuffer[], double &_senkouABuffer[], double &_senkouBBuffer[], double &_cloudSenkouSpanABuffer[], double &_cloudSenkouSpanBBuffer[] // ) { // double topValue; double bottomValue; // // TENKANSEN ... // // Extract Tenkan Sen Top/Bottom Calculation Mode based on User Input ... if (mTenkanSenTopMode == NULL || mTenkanSenBottomMode == NULL) { // switch (tenkanSenMode) { // case X_XICH_HH_LL_MODE: // mTenkanSenTopMode = MODE_HIGH; mTenkanSenBottomMode = MODE_LOW; break; // case X_XICH_HO_LC_MODE: // mTenkanSenTopMode = MODE_OPEN; mTenkanSenBottomMode = MODE_CLOSE; break; } } // XOHCL bar; bar.Init( _Symbol, _Period, bar_index // ); // // Calculate Top ... topValue = bar .FindHighest( _tenkanSenLength, mTenkanSenTopMode // ); // // Calculate Bottom ... bottomValue = bar .FindLowest( _tenkanSenLength, mTenkanSenBottomMode // ); // double tenkanSenValue = (topValue + bottomValue) / 2; _tenkanSenBuffer[bar_index] = tenkanSenValue; // // KIJUNSEN ... // // Extract Kijun Sen Top/Bottom Calculation Mode based on User Input ... if (mKijunSenTopMode == NULL || mKijunSenBottomMode == NULL) { // switch (kijunSenMode) { // case X_XICH_HH_LL_MODE: // mKijunSenTopMode = MODE_HIGH; mKijunSenBottomMode = MODE_LOW; break; // case X_XICH_HO_LC_MODE: // mKijunSenTopMode = MODE_OPEN; mKijunSenBottomMode = MODE_CLOSE; break; } } // // Calculate Top ... topValue = bar .FindHighest( _kijunSenLength, mKijunSenTopMode // ); // // Calculate Bottom ... bottomValue = bar .FindLowest( _kijunSenLength, mKijunSenBottomMode // ); // double kijunSenValue = (topValue + bottomValue) / 2; _kijunSenBuffer[bar_index] = kijunSenValue; // // CHIKOUSPAN ... double chikouSpanValue = bar .GetPrice(chikuoSpanAppliedTo); // _chikouSpanBuffer[bar_index] = chikouSpanValue; // // KUMO ... // // SENKOUSPANA ... double senkouSpanAValue = (tenkanSenValue + kijunSenValue) / 2; _senkouABuffer[bar_index] = senkouSpanAValue; _cloudSenkouSpanABuffer[bar_index] = senkouSpanAValue; // // SENKOUSPANB ... // // Extract Senkou Span B Top/Bottom Calculation Mode based on User Input ... if (mSenkouSpanBTopMode == NULL || mSenkouSpanBBottomMode == NULL) { // switch (senkouSpanBMode) { // case X_XICH_HH_LL_MODE: // mSenkouSpanBTopMode = MODE_HIGH; mSenkouSpanBBottomMode = MODE_LOW; break; // case X_XICH_HO_LC_MODE: // mSenkouSpanBTopMode = MODE_OPEN; mSenkouSpanBBottomMode = MODE_CLOSE; break; } } // // Calculate Top ... topValue = bar .FindHighest( _senkouSpanBLength, mSenkouSpanBTopMode // ); // // Calculate Bottom ... bottomValue = bar .FindLowest( _senkouSpanBLength, mSenkouSpanBBottomMode // ); // double senkouSpanBValue = (topValue + bottomValue) / 2; _senkouBBuffer[bar_index] = senkouSpanBValue; _cloudSenkouSpanBBuffer[bar_index] = senkouSpanBValue; // } //