need help coding easy pivot expert

 

Hi guys!

I would like some help coding an expert doing the following:

at daily open, take pos towards pivot. 

if possible adding if previous days pivot was not hit. Double the size

 
Jonas Rydqvist:
forgot to mentio its for metatrader 4 :) 

Post your request in Freelance section.

 
Jonas Rydqvist:

Hi guys!

I would like some help coding an expert doing the following:

at daily open, take pos towards pivot. 

if possible adding if previous days pivot was not hit. Double the size

If you want some help with your code, you should post your code that you have done so far and mention where you are having problems

 
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help
          urgent help.

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum

 
sorry, dont have any coding experience at all. Thought this code would be supereasy to do for anyone with basic skills. Did not know there was a freelance link. But will not pay for this though. If someone would want to help anyway i would appreciate it highly :) 
 
  1. You "dont have any coding experience at all." So what makes you think you can estimate it "would be supereasy?"
  2. Do you really expect that there are slaves just waiting to code your request for free?
 

Here is the pivot points algorithm if anyone is interest to incorporate it (for you)

#property version   "1.00"
#property strict
input string notea="<----->";//PIVOT POINT SETTINGS
enum pp_method
{
pp_standard=0,//Standard
pp_woodie=1,//Woodie
pp_camarilla=2,//Camarilla
pp_fibonacci=3//Fibonacci
};
input pp_method PP_Calculation_Method=pp_standard;//Pivot Point Method : 
input ENUM_TIMEFRAMES PP_Timeframe=PERIOD_D1;//Pivot Point Period : 

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
  
  //EXAMPLE WITH DATE 
  pivot_points_array ppa=CalculatePivotPoints(Symbol(),PP_Timeframe,PP_Calculation_Method,0,true,Time[0],1);
  //EXAMPLE WITH BAR 
  pivot_points_array ppa=CalculatePivotPoints(Symbol(),PP_Timeframe,PP_Calculation_Method,1,false,0,0);
  //if it succeeds
  if(ppa.valid_data)
   {
   double pivot_point=ppa.pivot_point;
   double resistance1=ppa.r1;
   double support1=ppa.s1;
   //and so on...
   }
  
   return(INIT_SUCCEEDED);
  }


//CALCULATE PIVOT POINTS 
  struct pivot_points_array
  {
  bool valid_data;//valid data return
  int total_levels;//total levels either side 
  double ppc_high;//high 
  double ppc_low;//low 
  double ppc_open;//open
  double ppc_close;//close
  double pivot_point;//pivot point
  double r1;//resistance 1 
  double r2;//resistance 2 
  double r3;//resistance 3 
  double r4;//resistance 4 
  double r5;//resistance 5 
  double s1;//support 1 
  double s2;//support 2 
  double s3;//support 3 
  double s4;//support 4 
  double s5;//support 5 
  };
  
  pivot_points_array CalculatePivotPoints(string symbol,
                                          ENUM_TIMEFRAMES tf,
                                          pp_method method,
                                          int bar_with_data,
                                          bool with_date,
                                          datetime date,
                                          int bar_offset)
  {
  /*
  Symbol , tf 
  method => pivot point method 
  bar_with_data => provide the target tf bar (from which data will be derived) if known and 
                   set with_date to false
  with_date => if target bar is not known set this to true ,provide the date available to you 
               and optionally set the offset bar_offset if needed.
               for example for daily pivot points used today on M5 we provide the time on the M5
               and a bar offset of +1(+ goes in the past ,- in the future) because the function will find the current (developing) daily 
               bar ,but we want the previous concluded day data
  bar_offset => as mentioned above  
  */
  pivot_points_array returnio;
  returnio.valid_data=false;
  returnio.total_levels=0;
  
  //bar for data 
  int bfd=bar_with_data;
  bool calculation_viable=true;
  if(with_date)
  {
  //find bar in target timeframe
  int btt=iBarShift(symbol,tf,date,false);
  //if invalid 
  if(btt==-1) calculation_viable=false;
  if(btt!=-1)
    {
    bfd=btt+bar_offset;
    } 
  }
  //pull prices 
  if(calculation_viable)
  {
  double ppc_high=iHigh(symbol,tf,bfd);
  double ppc_open=iOpen(symbol,tf,bfd);
  double ppc_close=iClose(symbol,tf,bfd);
  double ppc_low=iLow(symbol,tf,bfd);  
  int t_digits=(int)MarketInfo(symbol,MODE_DIGITS);
  //check prices returned 
    if(ppc_high<=0||ppc_low<=0||ppc_close<=0||ppc_open<=0||t_digits<=0) calculation_viable=false;
    if(ppc_high>0&&ppc_low>0&&ppc_close>0&&ppc_open>0&&t_digits>0)
    {
    double MRT_PP_base,MRT_PP_r1,MRT_PP_r2,MRT_PP_r3,MRT_PP_r4;
    double MRT_PP_s1,MRT_PP_s2,MRT_PP_s3,MRT_PP_s4;
    returnio.valid_data=true;
    returnio.ppc_close=ppc_close;
    returnio.ppc_open=ppc_open;
    returnio.ppc_high=ppc_high;
    returnio.ppc_low=ppc_low;
    //standard pivot points 
    if(method==pp_standard)
    {
    //pivot point
    MRT_PP_base=(ppc_high+ppc_low+ppc_close)/3;
    returnio.pivot_point=NormalizeDouble(MRT_PP_base,t_digits);
    //R1 
    MRT_PP_r1=(2*MRT_PP_base)-ppc_low;
    returnio.r1=NormalizeDouble(MRT_PP_r1,t_digits);
    //S1
    MRT_PP_s1=(2*MRT_PP_base)-ppc_high;
    returnio.s1=NormalizeDouble(MRT_PP_s1,t_digits);
    //R2
    MRT_PP_r2=MRT_PP_base+(ppc_high-ppc_low);
    returnio.r2=NormalizeDouble(MRT_PP_r2,t_digits);
    //S2
    MRT_PP_s2=MRT_PP_base-(ppc_high-ppc_low);
    returnio.s2=NormalizeDouble(MRT_PP_s2,t_digits);
    //R3
    MRT_PP_r3=ppc_high+2*(MRT_PP_base-ppc_low);
    returnio.r3=NormalizeDouble(MRT_PP_r3,t_digits);
    //S3
    MRT_PP_s3=ppc_low-2*(ppc_high-MRT_PP_base);
    returnio.s3=NormalizeDouble(MRT_PP_s3,t_digits);
    returnio.total_levels=3;
    }
    //standard pivot points ends here 
    //woodie pivot points 
    if(method==pp_woodie)
    {
    //pivot point
    MRT_PP_base=(ppc_high+ppc_low+2*ppc_close)/4;
    returnio.pivot_point=NormalizeDouble(MRT_PP_base,t_digits);
    //R1 
    MRT_PP_r1=(2*MRT_PP_base)-ppc_low;
    returnio.r1=NormalizeDouble(MRT_PP_r1,t_digits);
    //S1
    MRT_PP_s1=(2*MRT_PP_base)-ppc_high;
    returnio.s1=NormalizeDouble(MRT_PP_s1,t_digits);
    //R2
    MRT_PP_r2=MRT_PP_base+(ppc_high-ppc_low);
    returnio.r2=NormalizeDouble(MRT_PP_r2,t_digits);
    //S2
    MRT_PP_s2=MRT_PP_base-(ppc_high-ppc_low);
    returnio.s2=NormalizeDouble(MRT_PP_s2,t_digits);    
    //R3
    MRT_PP_r3=MRT_PP_base+2*(ppc_high-ppc_low);
    returnio.r3=NormalizeDouble(MRT_PP_r3,t_digits);
    //S3
    MRT_PP_s3=MRT_PP_base-2*(ppc_high-ppc_low);
    returnio.s3=NormalizeDouble(MRT_PP_s3,t_digits);   
    returnio.total_levels=3;
    }
    //woodie pivot points ends here 
    //camarilla pivot points 
    if(method==pp_camarilla)
    {
    //pivot point
    MRT_PP_base=(ppc_high+ppc_low+ppc_close)/3;
    returnio.pivot_point=NormalizeDouble(MRT_PP_base,t_digits);
    //R1 C + ((H-L) x 1.0833)
    MRT_PP_r1=ppc_close+((ppc_high-ppc_low)*1.0833);
    returnio.r1=NormalizeDouble(MRT_PP_r1,t_digits);
    //S1 C - ((H-L) x 1.0833)
    MRT_PP_s1=ppc_close-((ppc_high-ppc_low)*1.0833);
    returnio.s1=NormalizeDouble(MRT_PP_s1,t_digits);
    //R2
    MRT_PP_r2=ppc_close+((ppc_high-ppc_low)*1.1666);
    returnio.r2=NormalizeDouble(MRT_PP_r2,t_digits);
    //S2
    MRT_PP_s2=ppc_close-((ppc_high-ppc_low)*1.1666);
    returnio.s2=NormalizeDouble(MRT_PP_s2,t_digits);
    //R3
    MRT_PP_r3=ppc_close+((ppc_high-ppc_low)*1.2500);
    returnio.r3=NormalizeDouble(MRT_PP_r3,t_digits);
    //S3
    MRT_PP_s3=ppc_close-((ppc_high-ppc_low)*1.2500);
    returnio.s3=NormalizeDouble(MRT_PP_s3,t_digits);
    //R4
    MRT_PP_r4=ppc_close+((ppc_high-ppc_low)*1.5);
    returnio.r4=NormalizeDouble(MRT_PP_r4,t_digits);
    //S4
    MRT_PP_s4=ppc_close-((ppc_high-ppc_low)*1.5);
    returnio.s4=NormalizeDouble(MRT_PP_s4,t_digits);    
    returnio.total_levels=4;
    }
    //camarilla pivot points ends here   
    //fibonacci pivot points 
    if(method==pp_fibonacci)
    {
    //pivot point
    MRT_PP_base=(ppc_high+ppc_low+ppc_close)/3;
    returnio.pivot_point=NormalizeDouble(MRT_PP_base,t_digits);
    //R1 PP + ((High – Low) x .382)
    MRT_PP_r1=MRT_PP_base+((ppc_high-ppc_low)*0.382);
    returnio.r1=NormalizeDouble(MRT_PP_r1,t_digits);
    //S1
    MRT_PP_s1=MRT_PP_base-((ppc_high-ppc_low)*0.382);
    returnio.s1=NormalizeDouble(MRT_PP_s1,t_digits);
    //R2
    MRT_PP_r2=MRT_PP_base+((ppc_high-ppc_low)*0.618);
    returnio.r2=NormalizeDouble(MRT_PP_r2,t_digits);
    //S2
    MRT_PP_s2=MRT_PP_base-((ppc_high-ppc_low)*0.618);
    returnio.s2=NormalizeDouble(MRT_PP_s2,t_digits);
    //R3
    MRT_PP_r3=MRT_PP_base+((ppc_high-ppc_low));
    returnio.r3=NormalizeDouble(MRT_PP_r3,t_digits);
    //S3
    MRT_PP_s3=MRT_PP_base-((ppc_high-ppc_low));
    returnio.s3=NormalizeDouble(MRT_PP_s3,t_digits);
    returnio.total_levels=3;
    }
    //fibonacci pivot points ends here          
    }
  //check prices returned ends here 
  }
  return(returnio);
  }
//CALCULATE PIVOT POINTS ENDS HERE  
 
Jonas Rydqvist:
But will not pay for this though.

Why not ?

 
Lorentzos Roussos:

Here is the pivot points algorithm if anyone is interest to incorporate it (for you)

totally missed your response! thank u soo much! But when adding it as a new EA it gives one error. Deleted that sentance but it takes no positions...

Reason: