SessionVWAPCrossoverStepped by Naya

627 downloads / 408 views / Created: 06.06.2025
 Average Rating: 0

Indicator Description

SessionVWAPCrossoverStepped is a technical indicator that tracks the relationship between two Volume-Weighted Average Price (VWAP) lines with different reset periods. It helps identify trading opportunities when the fast VWAP crosses or interacts with the slow VWAP.

Key Features:
- Uses two VWAP calculations (fast and slow) with customizable reset periods
- Offers multiple crossover and comparison logic options
- Configurable anchor times for both VWAP calculations
- Works as both entry and exit filter
- Includes previous bar option for smoother signals

Parameters:
1. Fast VWAP Settings:
- Reset period (15-1440 minutes in 15-min steps)
- Anchor hour (0-23)
- Anchor minute (0,15,30,45)

2. Slow VWAP Settings:
- Reset period (15-1440 minutes in 15-min steps)
- Anchor hour (0-23)
- Anchor minute (0,15,30,45)

3. Signal Options:
- Fast crosses Slow upward/downward
- Fast above/below Slow
- Both rising/falling combinations
- Divergence patterns (Fast rises while Slow falls etc.)

Trading Uses:
- Generates signals when VWAP lines cross or meet certain conditions
- Can filter trades based on VWAP relationship
- Helps identify trend strength through VWAP convergence/divergence

Created by NAYA, this indicator provides a more flexible VWAP crossover system than standard implementations by allowing stepped reset periods and multiple comparison logics. It's particularly useful for traders who want to combine VWAP signals with different time perspectives.

Comments

using System; using System.Drawing; using ForexStrategyBuilder.Infrastructure.Entities; using ForexStrategyBuilder.Infrastructure.Enums; using ForexStrategyBuilder.Infrastructure.Interfaces; namespace ForexStrategyBuilder.Indicators.Custom { public class SessionVWAPCrossoverStepped : Indicator { public SessionVWAPCrossoverStepped() { IndicatorName = "SessionVWAPCrossoverStepped"; PossibleSlots = SlotTypes.OpenFilter | SlotTypes.CloseFilter; IndicatorAuthor = "NAYA +237674724684"; IndicatorVersion = "1.0"; IndicatorDescription = "SessionVWAP crossover (Fast vs. Slow) with stepped reset periods (Broker Time Sync)"; } public override void Initialize(SlotTypes slotType) { SlotType = slotType; // Logic IndParam.ListParam[0].Caption = "Logic"; IndParam.ListParam[0].ItemList = new[] { "Fast SessionVWAP crosses Slow SessionVWAP upward", "Fast SessionVWAP crosses Slow SessionVWAP downward", "Fast SessionVWAP is higher than Slow SessionVWAP", "Fast SessionVWAP is lower than Slow SessionVWAP", "Fast SessionVWAP rises, Slow SessionVWAP falls", "Fast SessionVWAP falls, Slow SessionVWAP rises", "Fast SessionVWAP rises, Slow SessionVWAP rises", "Fast SessionVWAP falls, Slow SessionVWAP falls" }; IndParam.ListParam[0].Index = 0; IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[0]; IndParam.ListParam[0].Enabled = true; IndParam.ListParam[0].ToolTip = "Logic of application of the indicator."; // Fast Reset Period IndParam.ListParam[1].Caption = "Fast Reset Period (minutes)"; var fastResetItems = new System.Collections.Generic.List(); for (int m = 15; m <= 1440; m += 15) fastResetItems.Add(m.ToString()); IndParam.ListParam[1].ItemList = fastResetItems.ToArray(); IndParam.ListParam[1].Index = 3; // Default to 60 minutes IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[3]; IndParam.ListParam[1].Enabled = true; IndParam.ListParam[1].ToolTip = "Fast VWAP reset period in minutes (15-1440, step 15)."; // Slow Reset Period IndParam.ListParam[2].Caption = "Slow Reset Period (minutes)"; var slowResetItems = new System.Collections.Generic.List(); for (int m = 15; m <= 1440; m += 15) slowResetItems.Add(m.ToString()); IndParam.ListParam[2].ItemList = slowResetItems.ToArray(); IndParam.ListParam[2].Index = slowResetItems.Count - 1; // Default to max IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[slowResetItems.Count - 1]; IndParam.ListParam[2].Enabled = true; IndParam.ListParam[2].ToolTip = "Slow VWAP reset period in minutes (15-1440, step 15)."; // Fast Anchor Hour IndParam.NumParam[0].Caption = "Fast Anchor Hour"; IndParam.NumParam[0].Value = 0; IndParam.NumParam[0].Min = 0; IndParam.NumParam[0].Max = 23; IndParam.NumParam[0].Enabled = true; IndParam.NumParam[0].ToolTip = "Hour (0-23) at which the Fast VWAP session begins."; // Fast Anchor Minute IndParam.ListParam[3].Caption = "Fast Anchor Minute"; var fastMinuteItems = new System.Collections.Generic.List(); for (int m = 0; m <= 45; m += 15) fastMinuteItems.Add(m.ToString("00")); IndParam.ListParam[3].ItemList = fastMinuteItems.ToArray(); IndParam.ListParam[3].Index = 0; IndParam.ListParam[3].Text = IndParam.ListParam[3].ItemList[0]; IndParam.ListParam[3].Enabled = true; IndParam.ListParam[3].ToolTip = "Minute (0-45, step 15) at which the Fast VWAP session begins."; // Slow Anchor Hour IndParam.NumParam[1].Caption = "Slow Anchor Hour"; IndParam.NumParam[1].Value = 0; IndParam.NumParam[1].Min = 0; IndParam.NumParam[1].Max = 23; IndParam.NumParam[1].Enabled = true; IndParam.NumParam[1].ToolTip = "Hour (0-23) at which the Slow VWAP session begins."; // Slow Anchor Minute IndParam.ListParam[4].Caption = "Slow Anchor Minute"; var slowMinuteItems = new System.Collections.Generic.List(); for (int m = 0; m <= 45; m += 15) slowMinuteItems.Add(m.ToString("00")); IndParam.ListParam[4].ItemList = slowMinuteItems.ToArray(); IndParam.ListParam[4].Index = 0; IndParam.ListParam[4].Text = IndParam.ListParam[4].ItemList[0]; IndParam.ListParam[4].Enabled = true; IndParam.ListParam[4].ToolTip = "Minute (0-45, step 15) at which the Slow VWAP session begins."; // Use previous bar value IndParam.CheckParam[0].Caption = "Use previous bar value"; IndParam.CheckParam[0].Enabled = true; IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar."; } private double[] CalculateSessionVWAP(int anchorHour, int anchorMinute, int resetPeriod) { int bars = Bars; double[] vwap = new double[bars]; double cumPV = 0.0; double cumV = 0.0; DateTime currentResetTime = DateTime.MinValue; for (int iBar = 3; iBar < bars; iBar++) { DateTime barTime = Time[iBar]; // MT4 CSV timestamp (opening time) DateTime barEndTime = barTime.AddMinutes((int)Period); // Bar end time DateTime lastReset = GetLastResetTime(barEndTime, anchorHour, anchorMinute, resetPeriod); if (lastReset != currentResetTime) { cumPV = 0.0; cumV = 0.0; currentResetTime = lastReset; } double typicalPrice = (Open[iBar] + High[iBar] + Low[iBar] + Close[iBar]) / 4.0; double volume = Math.Max(Volume[iBar], 0.000001); cumPV += typicalPrice * volume; cumV += volume; vwap[iBar] = cumV > 0.000001 ? (cumPV / cumV) : typicalPrice; } return vwap; } private DateTime GetLastResetTime(DateTime barEndTime, int anchorHour, int anchorMinute, int resetPeriod) { DateTime anchorToday = new DateTime( barEndTime.Year, barEndTime.Month, barEndTime.Day, anchorHour, anchorMinute, 0); if (barEndTime >= anchorToday) { TimeSpan timeSinceAnchor = barEndTime - anchorToday; int periods = (int)(timeSinceAnchor.TotalMinutes / resetPeriod); return anchorToday.AddMinutes(periods * resetPeriod); } else { DateTime anchorYesterday = anchorToday.AddDays(-1); TimeSpan timeSinceAnchor = barEndTime - anchorYesterday; int periods = (int)(timeSinceAnchor.TotalMinutes / resetPeriod); return anchorYesterday.AddMinutes(periods * resetPeriod); } } public override void Calculate(IDataSet dataSet) { DataSet = dataSet; int fastAnchorHour = (int)IndParam.NumParam[0].Value; int fastAnchorMinute = int.Parse(IndParam.ListParam[3].Text); int fastResetPeriod = Math.Max(int.Parse(IndParam.ListParam[1].Text), 1); int slowAnchorHour = (int)IndParam.NumParam[1].Value; int slowAnchorMinute = int.Parse(IndParam.ListParam[4].Text); int slowResetPeriod = Math.Max(int.Parse(IndParam.ListParam[2].Text), 1); int usePrev = IndParam.CheckParam[0].Checked ? 1 : 0; double[] fastVWAP = CalculateSessionVWAP(fastAnchorHour, fastAnchorMinute, fastResetPeriod); double[] slowVWAP = CalculateSessionVWAP(slowAnchorHour, slowAnchorMinute, slowResetPeriod); int firstBar = 3 + usePrev + 2; double[] oscillator = new double[Bars]; for (int bar = firstBar; bar < Bars; bar++) oscillator[bar] = fastVWAP[bar] - slowVWAP[bar]; Component = new IndicatorComp[4]; Component[0] = new IndicatorComp { CompName = "Fast SessionVWAP", DataType = IndComponentType.IndicatorValue, ChartType = IndChartType.Line, ChartColor = Color.Gold, FirstBar = firstBar, Value = fastVWAP }; Component[1] = new IndicatorComp { CompName = "Slow SessionVWAP", DataType = IndComponentType.IndicatorValue, ChartType = IndChartType.Line, ChartColor = Color.DarkBlue, FirstBar = firstBar, Value = slowVWAP }; Component[2] = new IndicatorComp { ChartType = IndChartType.NoChart, FirstBar = firstBar, Value = new double[Bars] }; Component[3] = new IndicatorComp { ChartType = IndChartType.NoChart, FirstBar = firstBar, Value = new double[Bars] }; if (SlotType == SlotTypes.OpenFilter) { Component[2].DataType = IndComponentType.AllowOpenLong; Component[2].CompName = "Is long entry allowed"; Component[3].DataType = IndComponentType.AllowOpenShort; Component[3].CompName = "Is short entry allowed"; } else if (SlotType == SlotTypes.CloseFilter) { Component[2].DataType = IndComponentType.ForceCloseLong; Component[2].CompName = "Close out long position"; Component[3].DataType = IndComponentType.ForceCloseShort; Component[3].CompName = "Close out short position"; } string logicText = IndParam.ListParam[0].Text; for (int bar = firstBar + usePrev; bar < Bars; bar++) { double fastCurrent = fastVWAP[bar - usePrev]; double fastPrevious = fastVWAP[bar - usePrev - 1]; double slowCurrent = slowVWAP[bar - usePrev]; double slowPrevious = slowVWAP[bar - usePrev - 1]; double oscCurrent = oscillator[bar - usePrev]; double oscPrevious = oscillator[bar - usePrev - 1]; switch (logicText) { case "Fast SessionVWAP crosses Slow SessionVWAP upward": Component[2].Value[bar] = (oscCurrent > 0 && oscPrevious <= 0) ? 1 : 0; Component[3].Value[bar] = (oscCurrent < 0 && oscPrevious >= 0) ? 1 : 0; break; case "Fast SessionVWAP crosses Slow SessionVWAP downward": Component[2].Value[bar] = (oscCurrent < 0 && oscPrevious >= 0) ? 1 : 0; Component[3].Value[bar] = (oscCurrent > 0 && oscPrevious <= 0) ? 1 : 0; break; case "Fast SessionVWAP is higher than Slow SessionVWAP": Component[2].Value[bar] = oscCurrent > 0 ? 1 : 0; Component[3].Value[bar] = oscCurrent < 0 ? 1 : 0; break; case "Fast SessionVWAP is lower than Slow SessionVWAP": Component[2].Value[bar] = oscCurrent < 0 ? 1 : 0; Component[3].Value[bar] = oscCurrent > 0 ? 1 : 0; break; case "Fast SessionVWAP rises, Slow SessionVWAP falls": Component[2].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; break; case "Fast SessionVWAP falls, Slow SessionVWAP rises": Component[2].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; break; case "Fast SessionVWAP rises, Slow SessionVWAP rises": Component[2].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; break; case "Fast SessionVWAP falls, Slow SessionVWAP falls": Component[2].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; break; } } } public override void SetDescription() { string baseString = IndicatorName + (IndParam.CheckParam[0].Checked ? "* (" : " ("); string fastParams = "Fast: {IndParam.NumParam[0].Value:00}:{IndParam.ListParam[3].Text}, {IndParam.ListParam[1].Text} min"; string slowParams = "Slow: {IndParam.NumParam[1].Value:00}:{IndParam.ListParam[4].Text}, {IndParam.ListParam[2].Text} min"; string paramString = "{fastParams} | {slowParams})"; string logic = IndParam.ListParam[0].Text; string longDesc = "", shortDesc = ""; switch (logic) { case "Fast SessionVWAP crosses Slow SessionVWAP upward": longDesc = "crosses Slow SessionVWAP upward"; shortDesc = "crosses Slow SessionVWAP downward"; break; case "Fast SessionVWAP crosses Slow SessionVWAP downward": longDesc = "crosses Slow SessionVWAP downward"; shortDesc = "crosses Slow SessionVWAP upward"; break; case "Fast SessionVWAP is higher than Slow SessionVWAP": longDesc = "is higher than Slow SessionVWAP"; shortDesc = "is lower than Slow SessionVWAP"; break; case "Fast SessionVWAP is lower than Slow SessionVWAP": longDesc = "is lower than Slow SessionVWAP"; shortDesc = "is higher than Slow SessionVWAP"; break; case "Fast SessionVWAP rises, Slow SessionVWAP falls": longDesc = "rises while Slow SessionVWAP falls"; shortDesc = "falls while Slow SessionVWAP rises"; break; case "Fast SessionVWAP falls, Slow SessionVWAP rises": longDesc = "falls while Slow SessionVWAP rises"; shortDesc = "rises while Slow SessionVWAP falls"; break; case "Fast SessionVWAP rises, Slow SessionVWAP rises": longDesc = "and Slow SessionVWAP are both rising"; shortDesc = "and Slow SessionVWAP are both falling"; break; case "Fast SessionVWAP falls, Slow SessionVWAP falls": longDesc = "and Slow SessionVWAP are both falling"; shortDesc = "and Slow SessionVWAP are both rising"; break; } EntryFilterLongDescription = "{baseString}{paramString}; Fast SessionVWAP {longDesc}"; EntryFilterShortDescription = "{baseString}{paramString}; Fast SessionVWAP {shortDesc}"; ExitFilterLongDescription = "{baseString}{paramString}; Fast SessionVWAP {longDesc}"; ExitFilterShortDescription = "{baseString}{paramString}; Fast SessionVWAP {shortDesc}"; } public override string ToString() { string prefix = IndicatorName + (IndParam.CheckParam[0].Checked ? "* (" : " ("); string fastStr = "Fast: {IndParam.NumParam[0].Value:00}:{IndParam.ListParam[3].Text}, {IndParam.ListParam[1].Text}"; string slowStr = "Slow: {IndParam.NumParam[1].Value:00}:{IndParam.ListParam[4].Text}, {IndParam.ListParam[2].Text}"; return "{prefix}{fastStr} | {slowStr})"; } } }
#property copyright "Copyright (C) 2025 NAYA +237674724684" #property link "https://forexsb.com" #property version "1.0" #property strict #include <Forexsb.com/Indicator.mqh> #include <Forexsb.com/Enumerations.mqh> class SessionVWAPCrossoverStepped : public Indicator { public: SessionVWAPCrossoverStepped(SlotTypes slotType) { SlotType = slotType; IndicatorName = "SessionVWAPCrossoverStepped"; WarningMessage = "SessionVWAP crossover with stepped reset periods (Broker Time Sync)"; IsAllowLTF = true; ExecTime = ExecutionTime_DuringTheBar; IsSeparateChart = false; IsDiscreteValues = false; IsDefaultGroupAll = false; } virtual void Calculate(DataSet &dataSet); private: void CalculateSessionVWAP(int anchorHour, int anchorMinute, int resetPeriod, double &vwap[]); datetime GetLastResetTime(datetime barTime, int anchorHour, int anchorMinute, int resetPeriod); }; void SessionVWAPCrossoverStepped::CalculateSessionVWAP(int anchorHour, int anchorMinute, int resetPeriod, double &vwap[]) { int bars = Data.Bars; ArrayResize(vwap, bars); ArrayInitialize(vwap, 0.0); double cumPV = 0.0; double cumV = 0.0; datetime currentReset = 0; for(int bar = 3; bar < bars; bar++) { datetime barTime = Data.Time[bar]; // MT4 bar opening time datetime barEndTime = barTime + Period() * 60; // Bar end time (broker timezone) datetime lastReset = GetLastResetTime(barEndTime, anchorHour, anchorMinute, resetPeriod); if(lastReset != currentReset) { cumPV = 0.0; cumV = 0.0; currentReset = lastReset; } double typicalPrice = (Data.Open[bar] + Data.High[bar] + Data.Low[bar] + Data.Close[bar]) / 4.0; double volume = MathMax(Data.Volume[bar], 0.000001); cumPV += typicalPrice * volume; cumV += volume; vwap[bar] = (cumV > 0.000001) ? (cumPV / cumV) : typicalPrice; } } datetime SessionVWAPCrossoverStepped::GetLastResetTime(datetime barEndTime, int anchorHour, int anchorMinute, int resetPeriod) { MqlDateTime tm; TimeToStruct(barEndTime, tm); // Create anchor time in broker timezone tm.hour = anchorHour; tm.min = anchorMinute; tm.sec = 0; datetime anchorTime = StructToTime(tm); if(barEndTime >= anchorTime) { // Calculate how many full reset periods have passed int minutesSinceAnchor = (int)((barEndTime - anchorTime) / 60); int periods = minutesSinceAnchor / resetPeriod; return anchorTime + (periods * resetPeriod * 60); } else { // Use yesterday's anchor time anchorTime -= 86400; // Subtract one day int minutesSinceAnchor = (int)((barEndTime - anchorTime) / 60); int periods = minutesSinceAnchor / resetPeriod; return anchorTime + (periods * resetPeriod * 60); } } void SessionVWAPCrossoverStepped::Calculate(DataSet &dataSet) { Data = GetPointer(dataSet); // Read parameters int fastAnchorHour = (int)NumParam[0].Value; int fastAnchorMinute = (int)StringToInteger(ListParam[3].Text); int fastResetPeriod = MathMax((int)StringToInteger(ListParam[1].Text), 1); int slowAnchorHour = (int)NumParam[1].Value; int slowAnchorMinute = (int)StringToInteger(ListParam[4].Text); int slowResetPeriod = MathMax((int)StringToInteger(ListParam[2].Text), 1); int previous = CheckParam[0].Checked ? 1 : 0; // Calculate VWAPs double fastVWAP[]; CalculateSessionVWAP(fastAnchorHour, fastAnchorMinute, fastResetPeriod, fastVWAP); double slowVWAP[]; CalculateSessionVWAP(slowAnchorHour, slowAnchorMinute, slowResetPeriod, slowVWAP); int firstBar = 3 + previous + 2; int bars = Data.Bars; // Calculate oscillator double oscillator[]; ArrayResize(oscillator, bars); ArrayInitialize(oscillator, 0.0); for(int bar = firstBar; bar < bars; bar++) oscillator[bar] = fastVWAP[bar] - slowVWAP[bar]; // Set components ArrayResize(Component, 4); ArrayResize(Component[0].Value, bars); Component[0].CompName = "Fast SessionVWAP"; Component[0].DataType = IndComponentType_IndicatorValue; Component[0].FirstBar = firstBar; ArrayCopy(Component[0].Value, fastVWAP); ArrayResize(Component[1].Value, bars); Component[1].CompName = "Slow SessionVWAP"; Component[1].DataType = IndComponentType_IndicatorValue; Component[1].FirstBar = firstBar; ArrayCopy(Component[1].Value, slowVWAP); ArrayResize(Component[2].Value, bars); ArrayInitialize(Component[2].Value, 0.0); Component[2].FirstBar = firstBar; ArrayResize(Component[3].Value, bars); ArrayInitialize(Component[3].Value, 0.0); Component[3].FirstBar = firstBar; // Set component types based on slot type if(SlotType == SlotTypes_OpenFilter) { Component[2].DataType = IndComponentType_AllowOpenLong; Component[2].CompName = "Is long entry allowed"; Component[3].DataType = IndComponentType_AllowOpenShort; Component[3].CompName = "Is short entry allowed"; } else if(SlotType == SlotTypes_CloseFilter) { Component[2].DataType = IndComponentType_ForceCloseLong; Component[2].CompName = "Close out long position"; Component[3].DataType = IndComponentType_ForceCloseShort; Component[3].CompName = "Close out short position"; } // Apply logic string logic = ListParam[0].Text; for(int bar = firstBar + previous; bar < bars; bar++) { double fastCurrent = fastVWAP[bar - previous]; double fastPrevious = fastVWAP[bar - previous - 1]; double slowCurrent = slowVWAP[bar - previous]; double slowPrevious = slowVWAP[bar - previous - 1]; double oscCurrent = oscillator[bar - previous]; double oscPrevious = oscillator[bar - previous - 1]; if(logic == "Fast SessionVWAP crosses Slow SessionVWAP upward") { Component[2].Value[bar] = (oscCurrent > 0 && oscPrevious <= 0) ? 1 : 0; Component[3].Value[bar] = (oscCurrent < 0 && oscPrevious >= 0) ? 1 : 0; } else if(logic == "Fast SessionVWAP crosses Slow SessionVWAP downward") { Component[2].Value[bar] = (oscCurrent < 0 && oscPrevious >= 0) ? 1 : 0; Component[3].Value[bar] = (oscCurrent > 0 && oscPrevious <= 0) ? 1 : 0; } else if(logic == "Fast SessionVWAP is higher than Slow SessionVWAP") { Component[2].Value[bar] = (oscCurrent > 0) ? 1 : 0; Component[3].Value[bar] = (oscCurrent < 0) ? 1 : 0; } else if(logic == "Fast SessionVWAP is lower than Slow SessionVWAP") { Component[2].Value[bar] = (oscCurrent < 0) ? 1 : 0; Component[3].Value[bar] = (oscCurrent > 0) ? 1 : 0; } else if(logic == "Fast SessionVWAP rises, Slow SessionVWAP falls") { Component[2].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; } else if(logic == "Fast SessionVWAP falls, Slow SessionVWAP rises") { Component[2].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; } else if(logic == "Fast SessionVWAP rises, Slow SessionVWAP rises") { Component[2].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; } else if(logic == "Fast SessionVWAP falls, Slow SessionVWAP falls") { Component[2].Value[bar] = (fastCurrent < fastPrevious - Sigma() && slowCurrent < slowPrevious - Sigma()) ? 1 : 0; Component[3].Value[bar] = (fastCurrent > fastPrevious + Sigma() && slowCurrent > slowPrevious + Sigma()) ? 1 : 0; } } }
Risk warning: Forex, spread bets and CFD are leveraged products. They may not be suitable for you as they carry a high degree of risk to your capital and you can lose more than your initial investment. You should ensure you understand all of the risks.
Copyright © 2006 - 2025, Forex Software Ltd.;