Fractal Arrow Prediction

Installation & Getting started guide

This topic contains 36 replies, has 8 voices, and was last updated by  mecki 3 years, 4 months ago.

Viewing 25 posts - 1 through 25 (of 37 total)
  • Author
  • #221

      First, make sure that you go through the following lesson that I posted:

      I assume that you have Node.js and XAMPP installed and gave phpMyAdmin a test run and that you have Apache and MySQL running. This script has only 2 files. One Node.js file and one MT4 indicator file (and the 3 library files for MT4 that you won’t have to touch).

      1. You can either make a clone of the GitHub project at OR click on the “Download ZIP” at the right menu to download it to your computer. I recommend that you learn to use GitHub so you can contribute to this project. You can commit your changes so that everyone can take a look easily and implement them to the final version.
      2. Copy and paste the MQL4 folder into your MT4 root directory (where you have MT4 installed). This will place the “Fractal Arrow” indicator. You can open it up in MetaEditor to take a look at the code and to compile (or restart MT4 so the indicator shows up).
      3. Next you can copy the Node folder to C:\ or somewhere else that you like.
      4. Next, open up phpMyAdmin (in XAMPP control panel, click on Admin next to). We are now going to create a database called Fractals and import the tables.
        • Click on “Databases” and under “Create database”, enter the new database name fractals and click Create
        • This should open up the newly created database, if not click on Fractals on the left menu. Then click on the Import tab at the top
        • Click on Choose File to Browse for the MySQL_Create_Tables.sql and click on “Go”. This will create the tables that are needed
      5. The next step is to install the needed modules for Node.js
        • You need to install the following: underscore, async, moment, prettyjson, mysql
        • To install each one, open up the Windows Command Prompt and change directory to your Node folder cd c:\Node
        • You can install these modules as global modules by entering npm install -g module_name For example: npm install -g async This will make it available system wide. If not the Node modules are installed into a node_modules folder that only the scripts above in it’s parent folder can access. Go ahead and install each one of the required modules above. If you get any errors, please let me know below.
        • If no errors, now you are ready run the node app. To run, simply enter node fractal_server.js
          This will start off the node process and execute the script. It will show you some debug messages that I placed in there.
      6. Now let’s make sure that you have the correct data in MT4. Open up MT4 and go to Tools > Options and set Max bars in history and Max bars in chart to something like 500000.
        Close theMT4 when this is done.

        • Next download Tickstory light in order to import the more accurate data from Dukas so that all of our data is in Sync from
        • Install tickstory and open it up. Click on Files and then Settings. Click on MT4 Settings Tab and click on Select next to MT4 Installation. Browse to your MT4 installation folder and click OK (it should be something like C:\Program Files(x86)\OANDA-MetaTrader\).
        • Look for EURUSD in the list of currencies in TickStory. Right click and Click on Export to MT4. Now for the From date, I picked 01/01/2010 and To date: today’s date.
        • Make sure the File Format is correct depending on the version of MT4 that you have running.
        • Then under Adjust time zone, make sure that you select your broker’s time zone.
        • The rest you can leave as default and then click on OK. It will start downloading and then export it out to MT4. It could take about an hour to download all the data.
      7. The final step is to run the “Fractal Arrow” indicator. I have made this so that the indicator would load the data into the database directly. This way its less files to be maintained and easier for users to get started. Since we are not running this in live mode in order to backtest, you need to run the strategy tester. You can download and run the following Blank EA

        Maybe it will be better if I turn this into an EA instead of an indicator. BUT the way it is now, you just have to run any EA and then attach the indicator.
        Assuming that you are running the Blank EA.

        • In the strategy tester, select the Blank EA from the list.
        • Symbol > EURUSD
          Model > Open prices only
          Use Date > Check the box, From 2010.12.30 To: 2014.01.01
          Visual mode > Check the box
          Period > M15
          Rest you can leave as default
        • So this is what we are doing now. We need to make sure that the chart contains bars from 2011.01.01 to 2012.12.31 since that’s the range that we are going to build the Sets for.
          • Make sure that you have set the Visual mode speed to about 25, if not it will run really fast and you won’t even get the chance to attach the indicator. Now click on Start (you may have to hit play if it starts up paused). The blank EA will run loading up the bars for the data range that we want in there. Then I just skip forward to 2012.12.31.
          • Assuming you have the node app running from Step 5 app already (if not start it up), lets attach the Fractal Arrow indicator to the chart. Go ahead and attach it. In the indicator’s settings, set the record_start_time to 2010.01.01 00:00 and record_end_time to 2012.12.31 00:00. Set load_data_first to true in order to populate the DB and to create the sets. You only have to do this once unless you make changes to the fractal/zigzag/bar logic.
          • And then watch the Windows Command Prompt to see its activity. It should load all the data and show you the lengths of the set1-3.
          • When you hit play and run the EA, you should see the arrows being drawn.

      If you have any questions or aren’t clear about a step above, please let me know and I will try to clarify. The last thing to do is to have you look through the code and to start working on this thing together. Next, I will write instructions or link to good set of instructions on how to use GitHub properly so you can make code commits for everyone to test out.

      Let’s finish this together! :-)

      You must be logged in to view attached files.

        Anybody had any luck getting this to run?

        Please let me know if something doesn’t make sense or need any clarification.


        Focus, Patience, Determination & Order in chaos


          Thanks for all your hard work and clear instructions SaverO. I’m not a programmer, so a pretty good candidate for “moron proofing” this.
          I can’t get this to run, and have found 2 issues thus far;

          1) The Fractal Arrow indicator doesn’t compile in my metatrader 4 (build 670), get 20 errors 10 warnings. So I used the already compiled (ex4) one from the zip file.

          2) When running the node fractal_server.js I get the following error message “can’t find module ‘underscore'” even though ‘underscore’ has been installed. Could this be because C/C++ compiler needed?



            That’s strange 4xbones. The errors should only show up if you were to compile it in strict mode with #property strict. I remember Madmoney had a similar issue a while ago as well with a different indicator I made. By any chance, are you running this in a virtual box?
            As for the “can’t find module ‘underscore’” error. You are getting this because you didn’t install the underscore Node.js module. Take a look at step 5c above.
            You need to install all of these modules: underscore, async, moment, prettyjson, mysql
            So in the command prompt, enter npm install underscore and when that’s done, enter npm install async, etc for all 5 of them above.

            Let me know if you encounter any more errors. I will research the compilation issue. Could you please post the 20 errors that you get?

            Thank you for trying it out! :-)

            Focus, Patience, Determination & Order in chaos


              Ok SaverO, here’s the metatrader errors (screenshot3). Actually, mainly to do with the included file mt4-http.mqh?

              Also, all modules were installed, including underscore. See attached (screenshot4) cmd.exe walk through, which repeats the error. I notice Pedma had a similar problem which was thought to be resolved by editing the system variables. I’ve tried the same, to no avail :(

              Thanks for your time.

              You must be logged in to view attached files.

                Hi 4xbones,

                Hop on the chat when you get a chance and hopefully we will both be online at the same time. If I miss you, let me know a time that works for you and I will try to be online.

                Let’s see if we can figure out the problem together.


                Focus, Patience, Determination & Order in chaos



                  Please try to at least get this to run by following the instructions and post your errors or issues that you see so we can try to get a group of people to work together on this.

                  I will be away on holiday for 2 weeks so on my return, I hope at least one or two people will be successful in getting this to run :-)

                  Thank you so much!

                  Focus, Patience, Determination & Order in chaos


                    Well, i get it to work. BUT… There are no any arrows. (?) Where can be problem? I saw only one arrow last time when i tried to open the indicator in H1 chart. It shows “BUY” arrow on latest candle before close on weekend. :(

                    Any idea, Saver? I know, you are not here now but i don’t know where can be problem. I will show you that log. (I just realised, there is still “ZEROS”. Why? I load it, exactly as you told. :/

                    expectBullish: 0,
                    BarLength: 8312 }
                    Set2P Checking pattern: 0,1,0,1,1,0,0,1,0,1,0,0,1,0
                    Set2P Checking pattern: 0,1,0,1,1,0,0,1,0,1,0,0,1,1
                    Set2P Checking pattern: 0,1,0,1,1,0,0,1,0,1,0,0,1
                    c1: false expLonger0: false expLonger1: false countFractalPattern: 0
                    c3: false
                    Completed the Run command
                    67330] Qued: 0 Idling?:Idling MSG:REQ:{“table”:”EUUS_fractal_m15″, “start_time”:

                    SyntaxError: Unexpected end of input
                    at Object.parse (native)
                    at IncomingMessage.<anonymous> (c:\Node\fractal_server.js:152:18)
                    at IncomingMessage.emit (events.js:92:17)
                    at _stream_readable.js:943:16
                    at process._tickCallback (node.js:419:13)

                    c:\Node>node fractal_server.js
                    Loading data starttime null euus_fractal_m5 SELECT * FROM euus_fractal_m5 ORDER
                    BY datetime ASC
                    All workers ready! – DB
                    Set 1 length:0
                    Set 2 length:0
                    auxFilteringSet length:0
                    Set 3 length:0

                    • This reply was modified 4 years, 11 months ago by  George.

                      Glad to hear that you got it to work!

                      Were you running it live or in the Strategy tester?

                      Set 1 length being 0 means that there isn’t any data in your DB. You need to run it in the strategy tester as I instructed in step 7. I assume that you ran it in Strategy tester but for some reason it didn’t record the data. Please let me know the steps you took in doing step 7.

                      Focus, Patience, Determination & Order in chaos


                        I did EXACTLY the same things you told us. There is nothing i can tell you .. CMD did nothing. It just stays like that. :) Picture:

                        I tried everything… Changing timefrime, tried opening prices only, but nothing happened. It’s just dead…

                        I opened strategy tester, set visual mod, timeframe 15m, then i started it. Then i skipped to 2012, paused tester, then insert indicators with everything (+ load data first), then play, and nothing. Just nothing.

                        I don’t know.


                          Hey Saver, i have idea. Can you send me your database? I will just import it, and the indicator will work for sure. Now, i really don’t where can be problem.


                            I assume that you attached the indicator as instructed.. but just in case, did you do the following where you attach the Fractal Arrow indicator to the chart with the setting of load_data_first set to true?
                            “Go ahead and attach it. In the indicator’s settings, set the record_start_time to 2010.01.01 00:00 and record_end_time to 2012.12.31 00:00. Set load_data_first to true in order to populate the DB and to create the sets. You only have to do this once unless you make changes to the fractal/zigzag/bar logic.”

                            We have to figure this out, it could mean that your client isn’t able to connect to the node application. Perhaps I should add some debug information so that it would do a connection test and let you know if it was successful or not.

                            Focus, Patience, Determination & Order in chaos


                              Yes i did exactly this step. More then 50 times. :D


                                Thanks George. I added some debug code and a connection test to the code. Please download the latest Fractal Arrow and the fractal_server.js from GitHub (

                                And give it a run in Strategy Tester like before. Then post the output from the fractal_server.js

                                Thank you!

                                Focus, Patience, Determination & Order in chaos


                                  Maybe i found an error… :D My MT4 (i tried more of them) can’t use the indicator. It just shows tons of errors. Yes, i tried mq4 and ex4.. Nothing. Build 711 :)

                                  Any idea? Or maybe try it. My broker is Admiral Markets.


                                    Another user also reported these errors. I’m thinking this has something to do with the compilers one has installed in the computer.
                                    Either way, I was able to reproduce some of the errors by setting the #property to strict. I updated the GitHub.
                                    Please download it and update all the code, including the indicator and the include files.
                                    Then have it a go. If you do not compile, the .ex4 should work. But let’s see if we can get you to compile this time.

                                    If you still get errors, could you please copy and paste errors from the MetaEditor right into here so it includes the Line number.

                                    Thank you George!

                                    Focus, Patience, Determination & Order in chaos


                                      Sorry for late reply, but i tried to figure it out. NOT WORKING. This is conclusion. YOU made something bad. I tested indicator NOW in build 670.

                                      When “LOAD_DATA_FIRST” is NOT checked, indicator WORKS.

                                      When LOAD_DATA_FIRST” IS CHECKED, indicator DOESN’T WORK!

                                      I asked You, to help me. How? “Send me your database… I will import it in my fractal database.”

                                      Did you send? Nope… We can’t fix it if you will not send me this what i asked. I think it’s not problem. :) So, will you help me now? Or i need to wait for another 2 years? :D Sorry but this is boring. I am not coder, and i just wanted one little thing from You. Without database, i can’t see it if work.

                                      You must be logged in to view attached files.

                                        I forgot to add this. In this package you have all the errors. With a little commment too.. Enjoy. :) :P.. And please, don’t forget to send me the database.. I will be really happy if you CAN do this. Thank You, Gw.

                                        You must be logged in to view attached files.

                                          Hi George!

                                          I looked at the errors you posted. It looks like you may not have placed the files found in \MQL4\Include folder into your MT4 \MQL4\Include folder. Specifically check to make sure mq4-http.mqh file is there. This is the file responsible for making the connection with the node.js server. This is what all the Internet related errors are when you compiled the file about.

                                          Also, another thing is that, this indicator is no way trading ready. It’s a work in progress and have a LOT more work left to do. It’s not accurate at all. I made it open source so that those of who are interested in working with me can work together to make this indicator better. So I actually need developers that can understand code and can work on this with me. It’s more of a group project. This is the reason why we need you to be able to generate the DB yourself. That is the very first step in order to work on this project. If people cannot figure out how to get the DB setup, then it would be difficult to do the rest of the work.

                                          I haven’t had any developers yet who can work with me on this. I have a few more things that I need to test out for this which I will get to very soon as I am busy with another project (

                                          Focus, Patience, Determination & Order in chaos


                                            After looking at the screenshot of the indicator working, I can say that you didn’t follow some the steps correctly. Step 7 C I to be specific. The skipping forward to part “Then I just skip forward to 2012.12.31”. The bars which you are recording has to be already be in the chart in order for it to record the data. I will make the data loading process better later when I find more time unless there is a develop that’s ready to work with me on this.

                                            Focus, Patience, Determination & Order in chaos


                                              Hello everybody!

                                              Great news! I worked with tradeforlife1 and we got everything to work. There was a bug. The bugs are fixed and I added additional checks. Everything should work if you follow the steps.

                                              Make sure you download the latest files from the GitHub repository.

                                              Special thanks to tradeforlife1 for working with me and for those of who tried. Sorry that I didn’t have time before to figure out the problem.

                                              Focus, Patience, Determination & Order in chaos


                                                Ah, lol… Awesome work Saver. :) Finally i get it to work… -_- Indicator is now online in my MT4. Still, it was not easy to get some data into database. Maybe problem was the databases were “read only”, or at least some of them. After about 5 times of running in the MetaTrader, i can get most of data into database. (BY THE WAY, THE INDICATOR WANTED ALL PRICES. NOT ONLY OPENING PRICES. WITH OPEN PRICES ONLY, I CAN’T SEE ARROW… Don’t know WHY) Not sure why i needed to run it 5x. After 5 times i can finally see some arrows.


                                                Lol, when i tried now.. I can see arrows. But only sometimes. It looks like i don’t have some info in database named fractals. Hmmmm.. But yeah it can work somehow. :)


                                                Now, what i need to do when i want in on my realtime chart? Do i need to use always 15M chart or it doesn’t matter? Because when i insert it on real chart i can see only “nothing”. :D




                                                  Hi George!

                                                  Glad that you got it to work. However, I think it might not have been working properly because you need to run the MySQL_Create_Tables.sql file again because it was creating the table for M5 instead of M15. I fixed it so make sure you download this file again and run it in your DB. (I just now published the fix to GitHub).

                                                  This isn’t designed to run live since its still a work in progress. There is still more work left to do to have any accuracy. Right now it’s very bad with the fractal arrow predictions. It needs a bit of coding work to become usable I think. As soon as I find some time, I will work on it again. But now with a lot of Forum work and my existing development work, it’s going to be difficult but I do plan to get to this if nobody else does  :whistle:


                                                  Focus, Patience, Determination & Order in chaos


                                                    SaverO, I want to commend you for this great effort. I have followed the set up instruction and i got it running but there is no fractal arrow showing on my chat.

                                                    I have attached a screen shot. I hope i am on the right path. I subscribe to this project, although i have little coding knowledge.



                                                    You must be logged in to view attached files.

                                                      Glad to see that you got it running. What do you see in the Node.js app?
                                                      When you post screenshots, please make sure that you post that as well.
                                                      Did you see the sets being created and the calculations for each new bar?

                                                      Focus, Patience, Determination & Order in chaos

                                                    Viewing 25 posts - 1 through 25 (of 37 total)

                                                    You must be logged in to reply to this topic.