wajdyss_FIBO_S_Indicator_V1
Download scriptThis script is a specialized trading indicator designed to identify specific price action reversals and trend shifts based on Fibonacci-style calculations. Rather than relying on standard moving averages or simple volume, it analyzes the relationship between historical price extremes (highs and lows) and current market movement.
Core Logic Overview
The logic operates by scanning historical data to establish significant "price zones." Here is a breakdown of how the system processes this information:
1. Dynamic Range Identification The script constantly looks back through specific timeframes (defined by the user as "periods") to identify the highest peaks and lowest valleys reached by the market. By doing this, it establishes a "range" which represents the primary playground for current price action.
2. Fibonacci Influence Once a range is identified, the script applies specific mathematical proportions—similar to those found in Fibonacci retracements (e.g., 0.382, 0.618, and 0.5). It uses these levels to determine where the price is likely to react or "bounce."
3. Momentum Tracking & Crossing Logic The primary "engine" of the script tracks how the current price interacts with these identified Fibonacci levels relative to the highs and lows of the established range. It looks for specific moments where the price breaks out of a previous boundary:
- Bullish Signals: When the price moves from a negative state (below a key level) to a positive state (breaking above a target), it signals an upward move.
- Bearish Signals: When the price drops from a positive state to a negative state (breaking below a target), it signals a downward move.
4. Visual and Audible Alerts When the logic detects these specific crossovers, the script performs several actions simultaneously:
- Visual Markers: It places arrows on the chart (Green for upward signals, Red for downward signals) to notify the trader of the entry point.
- On-Screen Text: It updates labels on your screen to provide information about the indicator's status and expiration.
- Auditory/System Alerts: If the "alert" setting is enabled, the script triggers a sound file and sends a pop-up notification. These alerts are programmed to provide specific instructions (e.g., "Close Sell Orders and Buy") based on which direction the price has broken.
5. Expiration Safeguard The script contains an integrated security feature that checks the current date against a hardcoded expiration date. If the current time exceeds the set limit, the indicator will visually notify the user that it has expired and will cease to perform its calculations or provide signals.
//+------------------------------------------------------------------+
//| wajdyss |
//| Copyright 2009 Wajdyss |
//| wajdyss@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2009 Wajdyss"
#property link "wajdyss@yahoo.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1
extern int TargetPeriod=34;
extern int FiboPeriod=17;
extern int Pips=20;
extern bool alert = true;
string file="alert.wav";
int TextSize=14;
color TextColor1=Black;
color TextColor2=Blue;
color TextColor3=Red;
color TextColor4=Black;
double CrossUp[];
double CrossDown[];
int eyear=9999;
int emonth=9;
int eday=9;
bool al1=false;
bool al2=false;
int date1=999;
int date2=999;
int date6=999;
int second=60;
string Name="wajdyss FIBO_S Indicator";
double ExtMapBuffer[];
double zzL[];
double zzH[];
double zz[];
double target1=0,target2=0;
//----
int a_begin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
Comment("");
ObjectDelete("a label");
ObjectDelete("b label");
ObjectDelete("c label");
ObjectDelete("d label");
ObjectDelete("e label");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//a
if(ObjectFind("a label") != 0)
{
ObjectCreate("a label", OBJ_LABEL, 0,0,0);
ObjectSetText("a label","ÈÓã Çááå ÇáÑÍãä ÇáÑÍíã" , TextSize, "Arial", TextColor1);
ObjectSet("a label", OBJPROP_XDISTANCE,650);
ObjectSet("a label", OBJPROP_YDISTANCE,0);
}
//b
if(ObjectFind("b label") != 0)
{
ObjectCreate("b label", OBJ_LABEL, 0,0,0);
ObjectSetText("b label",Name , TextSize, "Arial", TextColor2);
ObjectSet("b label", OBJPROP_XDISTANCE,610);
ObjectSet("b label", OBJPROP_YDISTANCE,25);
}
// c
if(ObjectFind("c label") != 0)
{
ObjectCreate("c label", OBJ_LABEL, 0,0,0);
ObjectSetText("c label","wajdyss@yahoo.com" , TextSize, "Arial", TextColor3);
ObjectSet("c label", OBJPROP_XDISTANCE,635);
ObjectSet("c label", OBJPROP_YDISTANCE,50);
}
// if (Period() != 1440) return(0);
if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
{
//d
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator has expired , contact us by E-mail" ,TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,550);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
return(0);
}
else
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator well expire after ( " + eday+"-"+emonth+"-"+eyear+" )",TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,565);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
ArrayResize(ExtMapBuffer, Bars+1);
// if (Period()!=1440 || Symbol()!="GBPJPY") return(0);
int same , notsame, samef, notsamef, samer, notsamer, samecandle, notsamecandle ;
double GSignalUP=0 , SignalUP=0 , GSignalDOWN=0, SignalDOWN=0 , AllSignal=0 , BSignalUP=0
, BSignalDOWN=0 ;
double samep,notsamep,all,GSignals,GSignalsP, GSignalUPP,GSignalDOWNP,fastMAnow,fastMAprevious,slowMAnow,slowMAprevious;
double FMA1,FMA2,SMA1,SMA2;
string sameforecast,notsameforecast, wajdyssforecast , status ;
double high,low,price;
int k;
int ii,shift,pos,lasthighpos,lastlowpos,curhighpos,curlowpos;
int targethighpos,targetlowpos;
double curlow,curhigh,lasthigh,lastlow,targethigh,targetlow;
double min, max;
lasthighpos=Bars; lastlowpos=Bars;
lastlow=Low[Bars];lasthigh=High[Bars];
targethighpos=Bars; targetlowpos=Bars;
targetlow=Low[Bars];targethigh=High[Bars];
for(shift=Bars-FiboPeriod; shift>=1; shift--)
{
curlowpos=Lowest(NULL,0,MODE_LOW,FiboPeriod,shift);
curlow=Low[curlowpos];
curhighpos=Highest(NULL,0,MODE_HIGH,FiboPeriod,shift);
curhigh=High[curhighpos];
if(shift<Bars-TargetPeriod){
targetlowpos=Lowest(NULL,0,MODE_LOW,TargetPeriod,shift);
targetlow=Low[targetlowpos];
targethighpos=Highest(NULL,0,MODE_HIGH,TargetPeriod,shift);
targethigh=High[targethighpos];
}
//------------------------------------------------
if( curlow>=lastlow ) { lastlow=curlow; }
else
{
if( lasthighpos>curlowpos )
{
zzL[curlowpos]=curlow;
min=100000; pos=lasthighpos;
for(ii=lasthighpos; ii>=curlowpos; ii--)
{
if (zzL[ii]==0.0) continue;
if (zzL[ii]<min) { min=zzL[ii]; pos=ii; }
zz[ii]=0.0;
}
zz[pos]=min;
}
lastlowpos=curlowpos;
lastlow=curlow;
}
//--- high
if( curhigh<=lasthigh ) { lasthigh=curhigh;}
else
{
if( lastlowpos>curhighpos )
{
zzH[curhighpos]=curhigh;
max=-100000; pos=lastlowpos;
for(ii=lastlowpos; ii>=curhighpos; ii--)
{
if (zzH[ii]==0.0) continue;
if (zzH[ii]>max) { max=zzH[ii]; pos=ii; }
zz[ii]=0.0;
}
zz[pos]=max;
}
lasthighpos=curhighpos;
lasthigh=curhigh;
}
double p, r5,r4,r3,r2,r1,r0;
double R2= targethigh - targetlow;
double R1= lasthigh - lastlow;
double R= High[lasthighpos] - Low[lastlowpos];
int div=10000;
color Line_color = Green;
color Target_color = Red;
if(Digits==2)div=100;
if(Digits==4)div=10000;
ExtMapBuffer[shift]=0;
if(lastlowpos<lasthighpos) {
p = curlow;
r5 = p + (R * 1);
r4 = p + (R * 0.618);
r3 = p + (R * 0.5);
r2 = p + (R * 0.382);
r1 = p + (R * 0.236);
r0 = p + (R * 0);
if(Close[0]>(targetlow+(R2*0.618)) )target1= targethigh + (R2 * 0.618);
if(Close[0]>target1)target1= 0;
if(Close[shift]>(curlow+(R1*0.382)) ) ExtMapBuffer[shift]=((Close[shift]-curlow)-R1)*div;
else ExtMapBuffer[shift]=((Close[shift]-curlow)-R1)*div;
//Comment(ExtMapBuffer[shift+1]);
}
if(lasthighpos<lastlowpos) {
p = curhigh;
r5 = p - (R * 1);
r4 = p - (R * 0.618);
r3 = p - (R * 0.5);
r2 = p - (R * 0.382);
r1 = p - (R * 0.236);
r0 = p - (R * 0);
if(Close[0]<(targethigh-(R2*0.618)) )target2= targetlow - (R2 * 0.618);
if(Close[0]<target2 )target2= 0;
if(Close[shift]<(curhigh-(R1*0.382)) ) ExtMapBuffer[shift]=(R1-(curhigh-Close[shift]))*div;
else ExtMapBuffer[shift]=(R1-(curhigh-Close[shift]))*div;
}
int i=shift;
if (ExtMapBuffer[i]>=0 && ExtMapBuffer[i+1]<0)
{
if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
{
//d
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator has expired , contact us by E-mail" ,TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,550);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
return(0);
}
else
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator well expire after ( " + eday+"-"+emonth+"-"+eyear+" )",TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,565);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
CrossUp[i] = Low[i]-Pips*Point;
AllSignal++;
SignalUP++;
if (iClose(Symbol(),NULL,i-1)>iOpen(Symbol(),NULL,i-1))
GSignalUP++;
else BSignalUP++;
}
else if (ExtMapBuffer[i]<0 && ExtMapBuffer[i+1]>=0)
{
if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
{
//d
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator has expired , contact us by E-mail" ,TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,550);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
return(0);
}
else
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator well expire after ( " + eday+"-"+emonth+"-"+eyear+" )",TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,565);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
CrossDown[i] = High[i]+Pips*Point;
AllSignal++;
SignalDOWN++;
if (iClose(Symbol(),NULL,i-1)<iOpen(Symbol(),NULL,i-1))
GSignalDOWN++;
else BSignalDOWN++;
}
}
int j=1;
i=1;
int date3=TimeHour(Time[j]);
int date4=TimeMinute(Time[j]);
int date5=TimeDay(Time[j]);
if (ExtMapBuffer[i]>=0 && ExtMapBuffer[i+1]<0 && alert==true && date1!=date3 && date2!=date4 && date5!=date6 && Seconds()<second)
{date1=date3; date2=date4; date6=date5; Alert (Name," Close Sell Orders And Buy ",Symbol()," AT ",iClose(Symbol(),0,i)); PlaySound(file); }
if (ExtMapBuffer[i]<0 && ExtMapBuffer[i+1]>=0 && alert==true && date1!=date3 && date2!=date4 && date5!=date6 && Seconds()<second)
{date1=date3; date2=date4; date6=date5; Alert (Name," Close Buy Orders And Sell ",Symbol()," AT ",iClose(Symbol(),0,i)); PlaySound(file); }
return(0);
}
Comments