MTF_SnakeForce~

Download script
MTF_SnakeForce~

This technical indicator, identified by its display name as "SnakeForce," is designed to analyze and visualize market momentum and directional pressure on a MetaTrader chart. It operates by calculating specific trends based on a user-defined period and projects these findings into a separate visual window beneath the main price chart.

Core Functionality

The primary logic of the script revolves around identifying "Force" in the market—essentially determining whether the prevailing momentum is pushing the price upward or downward. It achieves this through four distinct data streams, which are represented visually as histograms:

  • Upward Momentum: Two of the data streams are dedicated to tracking positive price pressure (colored Lime).
  • Downward Momentum: Two of the data streams are dedicated to tracking negative price pressure (colored Red).

Multi-Timeframe Intelligence

One of the most significant features of this script is its ability to handle "Multi-Timeframe" analysis. Instead of only looking at the chart you are currently viewing, the script can pull and calculate data from higher timeframes (such as Daily, Hourly, or Weekly) and project that information onto your current screen.

  • Data Synchronization: If you are viewing a lower timeframe (like 1-minute charts) but want to see the "Force" of a larger timeframe (like 4-hour charts), the script automatically synchronizes the data.
  • Smoothing: When viewing lower timeframes, the script ensures that the higher-timeframe data is held steady across the relevant candles. This prevents the visual "flickering" that often happens when switching between different time periods, providing a much smoother and more reliable visual representation of long-term trends.

Visual Representation

The indicator presents its findings in a dedicated sub-window to keep the main price chart clean. By using histograms, it allows traders to see at a glance:

  1. Strength: The size of the bars indicates the magnitude of the market force.
  2. Direction: The color coding (Lime vs. Red) provides an immediate visual cue on whether the current trend is bullish or bearish.
  3. Context: By using the "SnakeForce" logic, it helps traders distinguish between minor price fluctuations and significant, sustained momentum shifts.

In summary, this tool acts as a momentum filter that translates complex timeframe data into a simple, color-coded visual guide, helping users identify where the true "force" of the market is moving.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
MTF_SnakeForce~
/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_color4 Red

extern int TimeFrame = 0;
extern int cPeriod = 24;
double g_ibuf_84[];
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];

int init() {
   double ld_12;
   string ls_28;
   string ls_unused_40;
   int li_0 = 3 * cPeriod;
   IndicatorBuffers(5);
   SetIndexBuffer(0, g_ibuf_84);
   SetIndexBuffer(1, g_ibuf_88);
   SetIndexBuffer(2, g_ibuf_92);
   SetIndexBuffer(3, g_ibuf_96);
   SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 2);
   SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 2);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexStyle(3, DRAW_HISTOGRAM);
   SetIndexLabel(2, NULL);
   SetIndexLabel(3, NULL);
   SetIndexDrawBegin(0, li_0);
   SetIndexDrawBegin(1, li_0);
   SetIndexDrawBegin(2, li_0);
   SetIndexDrawBegin(3, li_0);
   double ld_4 = 1.0 * cPeriod * Period();
   if (ld_4 < 60.0) {
      ls_28 = DoubleToStr(ld_4, 0);
      ls_28 = " M" + ls_28 + ", FORCE UP -DOWN ";
   } else {
      ld_4 /= 60.0;
      if (ld_4 >= 24.0) {
         ld_12 = MathAbs(MathRound(ld_4 / 24.0) - ld_4 / 24.0);
         if (ld_12 < 0.01) {
            ls_28 = DoubleToStr(ld_4 / 24.0, 0);
            ls_28 = " D" + ls_28 + ", FORCE UP -DOWN ";
         } else {
            ls_28 = DoubleToStr(ld_4 / 24.0, 1);
            ls_28 = " D" + ls_28 + ", FORCE UP -DOWN ";
         }
      } else {
         ld_12 = MathAbs(MathRound(ld_4) - ld_4);
         if (ld_12 < 0.01) {
            ls_28 = DoubleToStr(ld_4, 0);
            ls_28 = " H" + ls_28 + ", FORCE UP -DOWN ";
         } else {
            ls_28 = DoubleToStr(ld_4, 1);
            ls_28 = " H" + ls_28 + ", FORCE UP -DOWN ";
         }
      }
   }
   switch (TimeFrame) {
   case 1:
      ls_unused_40 = "Period_M1";
      break;
   case 5:
      ls_unused_40 = "Period_M5";
      break;
   case 15:
      ls_unused_40 = "Period_M15";
      break;
   case 30:
      ls_unused_40 = "Period_M30";
      break;
   case 60:
      ls_unused_40 = "Period_H1";
      break;
   case 240:
      ls_unused_40 = "Period_H4";
      break;
   case 1440:
      ls_unused_40 = "Period_D1";
      break;
   case 10080:
      ls_unused_40 = "Period_W1";
      break;
   case 43200:
      ls_unused_40 = "Period_MN1";
      break;
   default:
      ls_unused_40 = "Current Timeframe";
   }
   IndicatorShortName("SnakeForce[" + TimeFrame + "](" + cPeriod + ")" + ls_28);
   return (0);
}

int start() {
   int lia_0[];
   int li_24;
   int lia_28[];
   int l_index_16 = 0;
   int l_ind_counted_20 = IndicatorCounted();
   ArrayCopySeries(lia_0, 5, Symbol(), TimeFrame);
   int li_12 = Bars - l_ind_counted_20 + TimeFrame / Period();
   int l_index_4 = 0;
   l_index_16 = 0;
   while (l_index_4 < li_12) {
      if (Time[l_index_4] < lia_0[l_index_16]) l_index_16++;
      g_ibuf_84[l_index_4] = iCustom(NULL, TimeFrame, "SnakeForce", cPeriod, 0, l_index_16);
      g_ibuf_88[l_index_4] = iCustom(NULL, TimeFrame, "SnakeForce", cPeriod, 1, l_index_16);
      g_ibuf_92[l_index_4] = iCustom(NULL, TimeFrame, "SnakeForce", cPeriod, 2, l_index_16);
      g_ibuf_96[l_index_4] = iCustom(NULL, TimeFrame, "SnakeForce", cPeriod, 3, l_index_16);
      l_index_4++;
   }
   if (TimeFrame > Period()) {
      li_24 = TimeFrame / Period() + 1;
      ArrayResize(lia_28, li_24);
      ArrayCopySeries(lia_28, 5, Symbol(), Period());
      for (l_index_4 = 0; l_index_4 < li_24 + 1; l_index_4++) {
         if (lia_28[l_index_4] >= lia_0[0]) {
            g_ibuf_84[l_index_4] = g_ibuf_84[0];
            g_ibuf_88[l_index_4] = g_ibuf_88[0];
            g_ibuf_92[l_index_4] = g_ibuf_92[0];
            g_ibuf_96[l_index_4] = g_ibuf_96[0];
         }
      }
   }
   return (0);
}

Comments