weekly pivot point question

 

Hi All,

I am new here and need a bit of help. Got this code for a weekly pivot installed for a fantastic winning sytem. One problem....the person who taught me 99% of what I need to know cannot be found. I tried using several online calculators to get pivot points to the ones that cannot be seen, only they are way different than my chart. They are often off by 20 or 30 pips. This can be very costly and make my whole system totally unreliable as is.

Has anyone seen this before? And could you clue me in on how to either calculate the pivot points myself, or find another solution. Maybe there is a super simple solution that I am unaware of....like zooming or scrolling to be able to see them.

Please help!

Thanks so much!

 

"...I tried using several online calculators to get pivot points to the ones that cannot be seen, only they are way different than my chart...." Please provide more information so people can understand what you're talking about.

 
BDBaby:

Hi All,

I am new here and need a bit of help. Got this code for a weekly pivot installed for a fantastic winning sytem. One problem....the person who taught me 99% of what I need to know cannot be found. I tried using several online calculators to get pivot points to the ones that cannot be seen, only they are way different than my chart. They are often off by 20 or 30 pips. This can be very costly and make my whole system totally unreliable as is.

Has anyone seen this before? And could you clue me in on how to either calculate the pivot points myself, or find another solution. Maybe there is a super simple solution that I am unaware of....like zooming or scrolling to be able to see them.

Please help!

Thanks so much!

What code? Is it indicator, script, EA?

 
diostar:

What code? Is it indicator, script, EA?



Here is the script:

//+------------------------------------------------------------------+
//| Auto-Pivot Plotter Weekly V1-00.mq4 |
//| Copyright © 2007, BundyRaider |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, BundyRaider"
#property link ""
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 RoyalBlue
#property indicator_color2 RoyalBlue
#property indicator_color3 RoyalBlue
#property indicator_color4 Goldenrod
#property indicator_color5 Red
#property indicator_color6 Red
#property indicator_color7 Red
#property indicator_color8 LimeGreen
#property indicator_width4 3
//---- input parameters
extern bool ChangeToFibonacci=False;
//---- buffers
double Res3[];
double Res2[];
double Res1[];
double Pivot[];
double Supp1[];
double Supp2[];
double Supp3[];
double Extra1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(0,Res3);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(1,Res2);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(2,Res1);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(3,Pivot);
SetIndexStyle(4,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(4,Supp1);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(5,Supp2);
SetIndexStyle(6,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(6,Supp3);
SetIndexStyle(7,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(7,Extra1);

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

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
//****************************

for(int i=0; i<limit; i++)
{
//if ( (i<((DaysToPlot+1)*BarsInDay))||DaysToPlot==0) // Used to limit the number of days
{ // that are mapped out. Less waiting ;)

// *****************************************************
// Find previous day's opening and closing bars.
// *****************************************************

//Find Our Week date.
datetime WeekDate=Time[i];
int WeeklyBar = iBarShift( NULL, PERIOD_W1, WeekDate,false)+1;
double PreviousHigh = iHigh(NULL, PERIOD_W1,WeeklyBar);
double PreviousLow = iLow(NULL, PERIOD_W1,WeeklyBar);
double PreviousClose = iClose(NULL, PERIOD_W1,WeeklyBar);
/*
int PreviousClosingBar = FindLastTimeMatchFast(CloseMinutesIntoDay,i+1);
int PreviousOpeningBar = FindLastTimeMatchFast(StartMinutesIntoDay,PreviousClosingBar+1);

double PreviousHigh= High[PreviousClosingBar];
double PreviousLow = Low [PreviousClosingBar];
double PreviousClose = Close[PreviousClosingBar];
*/
// *****************************************************
// Find previous day's high and low.
// *****************************************************

// ************************************************************************
// Calculate Pivot lines and map into indicator buffers.
// ************************************************************************

if(ChangeToFibonacci==False)
{
double P = (PreviousHigh+PreviousLow+PreviousClose)/3;
double R1 = (2*P)-PreviousLow;
double S1 = (2*P)-PreviousHigh;
double R2 = P+(PreviousHigh - PreviousLow);
double S2 = P-(PreviousHigh - PreviousLow);
double R3 = (2*P)+(PreviousHigh-(2*PreviousLow));
double S3 = (2*P)-((2* PreviousHigh)-PreviousLow);
//NormalizeDouble( P, Digits);
}
else
{
P = (PreviousHigh+PreviousLow+PreviousClose)/3;
R1 = P + ((PreviousHigh-PreviousLow) * 0.382);
S1 = P - ((PreviousHigh-PreviousLow) * 0.382);
R2 = P + ((PreviousHigh-PreviousLow) * 0.618);
S2 = P - ((PreviousHigh-PreviousLow) * 0.618);
R3 = P + ((PreviousHigh-PreviousLow) * 1.000);
S3 = P - ((PreviousHigh-PreviousLow) * 1.000);
//NormalizeDouble( P, Digits);
}

Pivot[i]= NormalizeDouble( P, Digits);
Res1[i] =R1;
Res2[i] =R2;
Res3[i] =R3;
Supp1[i]=S1;
Supp2[i]=S2;
Supp3[i]=S3;
// Extra1[i]=OpenPriceAt+i;
// **********************************************
// Calculate the mid-levels in to the buffers.
// (for mid-levels version)
// **********************************************(Twe)
// Res1[i] =((R1-P)/2)+P; //M3
// Res2[i] =((R2-R1)/2)+R1; //M4
// Res3[i] =((R3-R2)/2)+R2;
// Supp1[i]=((P-S1)/2)+S1; //M2
// Supp2[i]=((S1-S2)/2)+S2; //M1
// Supp3[i]=((S2-S3)/2)+S3;

} //End of 'DaysToPlot 'if' statement.
}
// ***************************************************************************************
// End of Main Loop
// ***************************************************************************************

// *****************************************
// Return from Start() (Main Routine)
return(0);
}
//+-------------------------------------------------------------------------------------------------------+
// END Custom indicator iteration function
//+-------------------------------------------------------------------------------------------------------+

// *****************************************************************************************
// *****************************************************************************************
// -----------------------------------------------------------------------------------------
// The following routine will use "StartingBar"'s time and use it to find the
// general area that SHOULD contain the bar that matches "TimeToLookFor"
// -----------------------------------------------------------------------------------------
 

one more attempt at attaching this chart snapshot...cant get it....not sure why

 
Here is a link showing all the different types of popular pivot point calculations. Try changing the calculations of the indicator to match what you're calculating online. Or forget about the other online calculators if you're positive the one within your indicator is correct. Some of the difference could come from different websites having different access to different price feeds or time shifts.
 

Awesome! Getting late here so I will try it tomorrow. Thanks a bunch!

 

You should have just attached this. Or at least use SRC.

Anyway, that is not a script. That's Custom Indicator. All you need to do, is to call iCustom(.... and call the different buffers value.

iCustom(NULL,0,"filename",TRUE|FALSE,<0-7>,0);
 

Thank you.

The babypips.com idea did not work. By all appearances, it looks like a Fibonacci Pivot point. But for whatever reason, the numbers don't match.

Please excuse my lack of understanding. Can you please explain more about this ..."All you need to do, is to call iCustom(.... and call the different buffers value." Please break it down to me on a very basic level.

Thanks again!

 
BDBaby:

Thank you.

The babypips.com idea did not work. By all appearances, it looks like a Fibonacci Pivot point. But for whatever reason, the numbers don't match.

Please excuse my lack of understanding. Can you please explain more about this ..."All you need to do, is to call iCustom(.... and call the different buffers value." Please break it down to me on a very basic level.

Thanks again!

that is calling custom indicator values. more about this, compare your code with the info ref: https://book.mql4.com/functions/index

So, at a basic level, that line basically, can pull out any or all the pivot values r1-r3, s1-s3, etc, at current bar, or for whichever x bars in the past, and use them for EA.

Reason: