Reply

Point and Figure

10 replies

nates!

Subscriber, bbp_participant, community, 7 replies.

Visit profile

7 years ago #116547

Is it possible to create a Point and Figure indicator or EA in EA Wizard?

Thanks in advance for any help or info.  🙂

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142290

Hello,

 

how do you work with Point&Figure in MetaTrader? It should be possible to do it. EA produced by Wizard is not limited by certain timeframe setting

0

nates!

Subscriber, bbp_participant, community, 7 replies.

Visit profile

7 years ago #142303

Hi. Thanks for your reply.  I currently use a Point and figure indicator I got from an internet forum which works well on Metatrader. I’ve imported it as a custom indicator in EA Wizard. I’ve tried using the output from the indicator in EA Wizard with no success. Obvioulsy, I’m not experienced in coding or the use of the EA wizard, so I’m not sure whether I’m doing anything wrong. That’s the reason why I am writing to this forum to find out maybe if I could just use the functions in EA wizard to create the point and figure logic and output. I would be happy to use either methods(custom indicator or create one myself) as long as I am able to program breakouts of the X’s and O’s in EA Wizard to create an EA.

I am not sure how to attach a mq4 file in this post so I have cut and pasted the code. Sorry for my ignorance. 🙁  Thanks!

 

//+——————————————————————+

//|                                                           XO.mq4 |
//|                                                     GranParadiso |
//|                                                [email protected] |
//+——————————————————————+
#property copyright “GranParadiso”
#property link      “[email protected]
 
#property indicator_chart_window
#property indicator_buffers         2
#property indicator_color1          Red
#property indicator_style1          STYLE_SOLID
#property indicator_width1          2
#property indicator_color2          Green
#property indicator_style2          STYLE_SOLID
#property indicator_width2          2
 
 
extern int  BoxSize                 = 5;
extern int  ReversalAmount          = 3;
 
 
int         LastCalculatedBarIndex;
int         LastTrend;
double      arr_XO_Open[];
double      arr_XO_Close[];
double      arr_Open[];
double      arr_Close[];
//+——————————————————————+
//|                                                                  |
//+——————————————————————+
int init()
  {
   IndicatorBuffers(4);
   SetIndexBuffer(0,arr_XO_Open);
   SetIndexStyle(0,DRAW_HISTOGRAM);
 
   SetIndexBuffer(1,arr_XO_Close);
   SetIndexStyle(1,DRAW_HISTOGRAM);
 
   SetIndexBuffer(2,arr_Open);
   SetIndexBuffer(3,arr_Close);
 
   return(0);
  }
//+——————————————————————+
//|                                                                  |
//+——————————————————————+
int start()
  {
   int
   j,
   k;
   double   UP,
   DW;
 
   int counted_bars=IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars>0) counted_bars–;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+1;
 
   for(int i=limit;i>=0;i–)
     {
      LastTrend=0;
      if(i==Bars-1)
        {
         arr_Open[i]=MathRound(Close[i]*(MathPow(10,Digits)/BoxSize))/(MathPow(10,Digits)/BoxSize);
         arr_Close[i]=arr_Open[i];
         continue;
        }
 
      if(arr_Open[i+1]>arr_Close[i+1]) LastTrend=-1;
      if(arr_Open[i+1]<arr_Close[i+1]) LastTrend=1;
 
      arr_Close[i]=arr_Close[i+1];
      arr_Open[i]=arr_Open[i+1];
 
      UP=0.0;
      DW=0.0;
 
      UP=(High[i]-arr_Close[i])/Point;
      DW=(arr_Close[i]-Low[i])/Point;
 
      switch(LastTrend)
        {
         case  1:
            if(UP<BoxSize) UP=0.0;
            else UP=MathFloor(UP/BoxSize)*BoxSize;
            if(DW<(BoxSize*ReversalAmount)) DW=0.0;
            else DW=MathFloor(DW/BoxSize)*BoxSize;
            arr_Close[i]=arr_Close[i]+UP*Point;
            if(DW!=0.0)
              {
               arr_Close[i+1]=arr_Close[i+1]+UP*Point;
               arr_Open[i]=arr_Close[i+1]-BoxSize*Point;
               arr_Close[i]=arr_Close[i+1]-UP*Point-DW*Point;
              }
            break;
 
         case -1:
            if(UP<(BoxSize*ReversalAmount)) UP=0.0;
            else UP=MathFloor(UP/BoxSize)*BoxSize;
            if(DW<BoxSize) DW=0.0;
            else DW=MathFloor(DW/BoxSize)*BoxSize;
            arr_Close[i]=arr_Close[i]-DW*Point;
            if(UP!=0.0)
              {
               arr_Close[i+1]=arr_Close[i+1]-DW*Point;
               arr_Open[i]=arr_Close[i+1]+BoxSize*Point;
               arr_Close[i]=arr_Close[i+1]+UP*Point+DW*Point;
              }
            break;
 
         default:
            if(UP<(BoxSize*ReversalAmount)) UP=0.0;
            else UP=MathFloor(UP/BoxSize)*BoxSize;
            if(DW<(BoxSize*ReversalAmount)) DW=0.0;
            else DW=MathFloor(DW/BoxSize)*BoxSize;
            arr_Close[i]=arr_Close[i]+UP*Point;
            arr_Close[i]=arr_Close[i]-DW*Point;
            break;
        }
     }
 
   limit=0;
   k=0;
   if(arr_Open[0]!=arr_XO_Open[0])
     {
      limit=Bars;
      arr_XO_Open[0]=arr_Open[0];
      arr_XO_Close[0]=arr_Close[0];
     }
   for(j=1;j<limit;j++)
     {
      if(arr_Open[j]!=arr_XO_Open[k])
        {
         k++;
         arr_XO_Open[k]=arr_Open[j];
         arr_XO_Close[k]=arr_Close[j];
        }
     }
 
   return(0);
  }
//+——————————————————————+

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142318

Hello,

 

ok I will check what can be done here

0

nates!

Subscriber, bbp_participant, community, 7 replies.

Visit profile

7 years ago #142336

Thanks for your help…much appreciated!

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142359

Hello,

 

have you managed to import the indicator as shown on the screenshot attached?

0

nates!

Subscriber, bbp_participant, community, 7 replies.

Visit profile

7 years ago #142362

Hi,

 

Yes, I have imported it that way.  As I mentioned, i tried using the outputs ( ie. arr_XO_Open a,d  arr_XO_Close) in EA wizard but was unsuccessful. I may have used it the wrong way….i assumed that those 2 variables were the X or O levels of the point and figure chart. Have you any luck in using those 2 ouputs in any way?

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142371

Hello,

 

yes, it works for me well with the EA attached

0

nates!

Subscriber, bbp_participant, community, 7 replies.

Visit profile

7 years ago #142376

Hi,

 

I’m having trouble opening the file you sent. When I double click.. it says Windows cant open it. I’ve tried notepad but it opens with a lot of text that im not familiar with. Any suggestions? 

Also…when you say it works well for you..do you mean that those variables ( arr_XO_open, arr_XO_close) can be used as the X and O levels in the EA?  Which would I use? I basically want to be able to program a breakout, by a user inputed amount, of the ‘X” or “O” column of a point and figure chart. In the EA that I tried before I wrote to this forum, I programmed it to buy at market if the variables were broken by a fixed amount. When I tried the EA in the strategy tester in MT4, there were no trades done. 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142378

Hello,

 

nevermind, see screenshots attached on how I set it up

File: PF1.jpgPF1.jpg
File: PF2.jpgPF2.jpg
File: PF3.jpgPF3.jpg

0

nates!

Subscriber, bbp_participant, community, 7 replies.

Visit profile

7 years ago #142459

Hi. Thanks for your help.  Because of your use of the “Log to Journal” function, I’ve managed to find out what the 2 variables (arr_XO_open, arr_XO_close) were and their values. I am trying to make use of those values in my attempt at an EA. Major work in progress tho!   Thanks for your help again and I’ll most likely be back in this forum in the near future asking for more! Thanks!

0

Viewing 10 replies - 1 through 10 (of 10 total)