FractalsJPYDNv2

Download script
Author: Copyright � 2007, by 7ergik
FractalsJPYDNv2

This script is a specialized market analysis tool designed for MetaTrader 4. It functions as a multi-currency visual indicator that identifies specific price patterns—known as "Fractals"—across six different Japanese Yen (JPY) currency pairs simultaneously.

Core Functionality

The primary purpose of this tool is to track "Lower Fractals" on several assets: GBP/JPY, EUR/JPY, CHF/JPY, CAD/JPY, AUD/JPY, and NZD/JPY. In technical analysis, a Lower Fractal typically represents a local price bottom or a point where the price has shifted direction from downward to upward.

How the Logic Works

Instead of simply showing you the movement of a single chart, this script performs the following operations in real-time:

  • Cross-Asset Monitoring: The tool scans six different currency pairs at once. It looks for specific price "bottoms" on each of these pairs, even if you are currently viewing a different chart.
  • Time Synchronization: The script is designed to be time-aware. It finds the exact moment a fractal occurs on one currency pair and matches it to the corresponding time on your current chart.
  • Dynamic Distance Calculation: The script uses a mathematical calculation involving the "Average True Range" (ATR). This is used to determine a specific visual distance for the markers, ensuring they are displayed clearly and consistently based on the market's volatility.
  • Visual Plotting: When the script identifies these fractal bottoms, it places an arrow marker on your chart. If multiple currency pairs hit their "bottom" at the exact same time, the script intelligently adjusts the placement of these markers so they do not overlap, making them easier for a human trader to read clearly.

Summary for Traders

Essentially, this tool acts as a "sentiment scanner." By highlighting when several different Yen-based currencies reach local bottoms simultaneously, it provides a visual signal that may indicate a collective shift in market momentum or a specific zone of interest across the broader Japanese Yen trading landscape.

Price Data Components
Series array that contains the lowest prices of each bar
Indicators Used
Indicator of the average true rangeFractals
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
FractalsJPYDNv2
//+------------------------------------------------------------------+
//|                                                     Fractals.mq4 |
//|                                      Copyright © 2007, by 7ergik |
//|                                           sergikizkazani@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, by 7ergik"
#property link      "sergikizkazani@mail.ru"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 C'255,130,130'
#property indicator_color2 C'255,87,87'
#property indicator_color3 C'255,43,43'
#property indicator_color4 C'255,0,0'
#property indicator_color5 C'190,0,0'
#property indicator_color6 C'130,0,0'
//---- input parameters
extern double k=0.2,ATR=89;
//---- buffers
double FractalsDNGBPJPY[];
double FractalsDNEURJPY[];
double FractalsDNCHFJPY[];
double FractalsDNCADJPY[];
double FractalsDNAUDJPY[];
double FractalsDNNZDJPY[];
double HL;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    if(Point==1) int Dig=0;
  if(Point==0.1) Dig=1;
  if(Point==0.01) Dig=2;
  if(Point==0.001) Dig=3;
  if(Point==0.0001) Dig=4;
  if(Point==0.00001) Dig=5;
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,218);
   SetIndexBuffer(0,FractalsDNGBPJPY);
   SetIndexEmptyValue(0,0);
   SetIndexLabel(0,"GBPJPY");

   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,218);
   SetIndexBuffer(1,FractalsDNEURJPY);
   SetIndexEmptyValue(1,0.0);
   SetIndexLabel(1,"EURJPY");

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,218);
   SetIndexBuffer(2,FractalsDNCHFJPY);
   SetIndexEmptyValue(2,0.0);
   SetIndexLabel(2,"CHFJPY");
      
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,218);
   SetIndexBuffer(3,FractalsDNCADJPY);
   SetIndexEmptyValue(3,0.0);
   SetIndexLabel(3,"CADJPY");
      
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,218);
   SetIndexBuffer(4,FractalsDNAUDJPY);
   SetIndexEmptyValue(4,0.0);
   SetIndexLabel(4,"AUDJPY");
      
   SetIndexStyle(5,DRAW_ARROW);
   SetIndexArrow(5,218);
   SetIndexBuffer(5,FractalsDNNZDJPY);
   SetIndexEmptyValue(5,0.0);  
   SetIndexLabel(5,"NZDJPY"); 
   


   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
string PAIR=Symbol();
int limit,i,counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i=limit; i>=0; i--)
{
int FractalsTotal=0;
HL=MathRound(iATR(PAIR,0,ATR,i)*k/Point)*Point;
FractalsDNGBPJPY[i]=iFractals("GBPJPY",0,MODE_LOWER,iBarShift("GBPJPY",0,iTime(PAIR,0,i),false));
if (FractalsDNGBPJPY[i]==iLow("GBPJPY",0,iBarShift("GBPJPY",0,iTime(PAIR,0,i),false))) FractalsTotal++;

FractalsDNEURJPY[i]=iFractals("EURJPY",0,MODE_LOWER,iBarShift("EURJPY",0,iTime(PAIR,0,i),false));
if (FractalsDNEURJPY[i]==iLow("EURJPY",0,iBarShift("EURJPY",0,iTime(PAIR,0,i),false))) FractalsTotal++;

FractalsDNCHFJPY[i]=iFractals("CHFJPY",0,MODE_LOWER,iBarShift("CHFJPY",0,iTime(PAIR,0,i),false));
if (FractalsDNCHFJPY[i]==iLow("CHFJPY",0,iBarShift("CHFJPY",0,iTime(PAIR,0,i),false))) FractalsTotal++;

FractalsDNCADJPY[i]=iFractals("CADJPY",0,MODE_LOWER,iBarShift("CADJPY",0,iTime(PAIR,0,i),false));
if (FractalsDNCADJPY[i]==iLow("CADJPY",0,iBarShift("CADJPY",0,iTime(PAIR,0,i),false))) FractalsTotal++;

FractalsDNAUDJPY[i]=iFractals("AUDJPY",0,MODE_LOWER,iBarShift("AUDJPY",0,iTime(PAIR,0,i),false));
if (FractalsDNAUDJPY[i]==iLow("AUDJPY",0,iBarShift("AUDJPY",0,iTime(PAIR,0,i),false))) FractalsTotal++;

FractalsDNNZDJPY[i]=iFractals("NZDJPY",0,MODE_LOWER,iBarShift("NZDJPY",0,iTime(PAIR,0,i),false));
if (FractalsDNNZDJPY[i]==iLow("NZDJPY",0,iBarShift("NZDJPY",0,iTime(PAIR,0,i),false))) FractalsTotal++;


if (FractalsDNGBPJPY[i]==iLow("GBPJPY",0,iBarShift("GBPJPY",0,iTime(PAIR,0,i),false))) {FractalsDNGBPJPY[i]=iLow(PAIR,0,i)-HL*FractalsTotal;FractalsTotal--;}
if (FractalsDNEURJPY[i]==iLow("EURJPY",0,iBarShift("EURJPY",0,iTime(PAIR,0,i),false))) {FractalsDNEURJPY[i]=iLow(PAIR,0,i)-HL*FractalsTotal;FractalsTotal--;}
if (FractalsDNCHFJPY[i]==iLow("CHFJPY",0,iBarShift("CHFJPY",0,iTime(PAIR,0,i),false))) {FractalsDNCHFJPY[i]=iLow(PAIR,0,i)-HL*FractalsTotal;FractalsTotal--;}
if (FractalsDNCADJPY[i]==iLow("CADJPY",0,iBarShift("CADJPY",0,iTime(PAIR,0,i),false))) {FractalsDNCADJPY[i]=iLow(PAIR,0,i)-HL*FractalsTotal;FractalsTotal--;}
if (FractalsDNAUDJPY[i]==iLow("AUDJPY",0,iBarShift("AUDJPY",0,iTime(PAIR,0,i),false))) {FractalsDNAUDJPY[i]=iLow(PAIR,0,i)-HL*FractalsTotal;FractalsTotal--;}
if (FractalsDNNZDJPY[i]==iLow("NZDJPY",0,iBarShift("NZDJPY",0,iTime(PAIR,0,i),false))) {FractalsDNNZDJPY[i]=iLow(PAIR,0,i)-HL*FractalsTotal;FractalsTotal--;}





}
   
   
   
   
   return(0);
  }

Comments