fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    What is the right way to do this with Fx Dreema

    Questions & Answers
    2
    5
    8782
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tiag01 last edited by

      Hi All,

      I think what your doing with fxDreema is fantastic!

      It allows me to focus my time on the conditions of entry and exit. My custom indicators worked a treat with determining the buffers and such - great stuff.

      I am trying where-ever possible to make everything use blocks, so that I can re-arrange and add other conditions or flow without having to change by hand hard-coded blocks.

      I have a few common tasks I write within my EAs and wonder what is the right fxDreema way to do these things:

      On the init() in my EA usually works on one timeframe and either on one particular currency pair or other currency pairs that have different global values such as stop loss, take profit, trailing stop, etc.

      Question 1:

      In my code today if I do the following:

       if (Period() != PERIOD_M5) {
            Comment("ERROR: This EA needs works on the 5 minutes interval, Please CLICK the M5 button.  EA STOPPED.  Please click on the M5 for this EA to work.");
            StopEA = true;  // this in start will just return on tick, exiting ea with message would be nice as well.
            return (-1);
         }
      

      I understand that Comment is available as a block and creating a Flag called StopEA is available as a block.

      I can't see a block that contains the actual major MT4 properties for the chart / timeframe. There is account and such which is great but I can't see it.

      If you could add this that would be great.

      if (StringSubstr(Symbol(), 0, 6) != "EURUSD"){
            Comment("ERROR: Currency Chart needs to be AUDUSD chart. EA STOPPED.  Remove EA from current chart and Attach EA to AUDUSD 5M Chart. Currently on chart:", StringSubstr(Symbol(), 0, 6) );
            StopEA = true;
            return (-1);
         } 
      

      Once again I can't see Symbol, I do the string substr as a number of brokers add a suffix.

      At the top of my start() block i have the StopEA flag true or false. with False just putting an error message.

      I don't mind coding for some of my esoteric functions, however I thought these simple points would be out of the box.

      In library studio how do I make these two functions be in a block? Is there any good examples that actually give a true /false value that I can use as a basis. I couldn't actually find any good documentation and a meaningful example for the library studio. An example where you have a function that returns values.

      Another example is I want to set the buy lot size to a result of my own function. I would like to avoid custom MQL4 code and make this a block.

      Say I wanted the lot size determined by dividing the account balance by 1,000

      Lots = MathMax( NormalizeDouble( (((MathFloor(AccountBalance() /1000))) * 0.01) , LotsDigits) , MinLots) ;
      

      How do I make this function as a block so I can put that in before the buy/sell block?. Your help would be much appreciated.

      I don't mind make a number of my blocks I create - provided they are useful for others / and it's easy to do in Library studio - available to everyone.

      I would like to make some function blocks so that other people could use them as well.

      Looking at a number of my EAs I notice a few functions not available from the system library, that might be beneficial to others: (Apologies if this is already available out of the box - new to this tool)

      • after an on bar event, whenever the order history has changed and it's either a buy or sell (not a pending order cancel, manual cancel, credit or debit) then call a function adding these orders to a Loop, with this let let me send this data to a file or to a server with a list of parameters while returning the new lot size.

      • A cool feature for me would be a stats table that holds distances from different values such as distance from 100 SMA and other SMA, and distance from price. You set all these values and then when a trade is completed you output these values with the profit and can be used to determine what other values can be used to make the EA profitable.

      • I would like you to support a PSAR trailing stop and a ATR trailing stop (I can provide code for this, if that makes it easier)

      • detect a GAP, i don't want to trade on after a GAP.

      • a simple volatility check, if the average distance between the high and the low for the last n bars is >=N

      • liquidity check - too little ticks, get average number of ticks.

      • for Money management you normally have five strategies
        1 = fixed lot
        2 = fixed fraction
        3 = fixed ratio
        4 = percent risk
        5 = percent volatility

      • please support lot size as fixed ratio
        Fixed ratio MM uses a variable % risk to ensure a constant ratio between position size and the rate at which position sizes increase: your risk is higher when your account is small than it is when your account is large.

      See http://www.forexfactory.com/showthread.php?t=171200 for more details

      Some of the functions available are very powerful and I think some documentation is holding back people getting their full worth from this product. It would be nice to have an FAQ that points to features of the blocks that support different problems. For example, "If the trade is older than say 2 days then close the trade."
      This can be achieved from the Category: "Actions over the group of trades"
      Close each trade has the ability to close trades that have meet a user specified expiration time.

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        Wow, lots of things you mention here.

        Normally I don't use global variables inside blocks. I prefer each block to be independent. This makes global variables free to use from people for custom reasons.

        Custom block can be made without assingning input parameters to it, just by placing source code and nothing more. But blocks are not designed to return values, because they are not capable of reading values from other blocks (today). They comuunicate each other with logical connections. This word is used in a block's source code to make possible the execution of next blocks that are connected:

        ~next~
        

        and this one to use the opposite output

        ~inext~
        

        These words are later replaced with another code depending on what connections are made in fxDreema.

        When you want to return values you can create custom functions (lower right part of the screen).

        You are right that Library Studio is not well documented. The same with the main part of the platform, which is highest priority and now I started to make more examples of it. But I can show you how I create blocks with Library Studio via TeamViewer, if you want.

        You can place those codes in a custom block, only the "return" part will have no meaning, because the code will be finally located outside init().

        In Buy now and Sell now, you can define lot size as dynamic value or even to write "MyLotSize" instead of "0.1", if "MyLotSize" is a global variable. And that variable can be modified before going to open a new trade in a few ways, one of them is by using custom block or custom function.

        Other things you mention are also good, I like new ideas. I will add them to my mental list of features for later 🙂

        1 Reply Last reply Reply Quote 0
        • T
          tiag01 last edited by

          Thanks for the quick reply 😄

          The penny dropped when you said, " But blocks are not designed to return values, because they are not capable of reading values from other blocks (today). They comuunicate each other with logical connections". That makes sense - your builder for blocks is about determining programmatic flow - next block.

          "When you want to return values you can create custom functions (lower right part of the screen)."
          I can see in Library studio that I can create custom functions - just usage of them seems a little too constrained. I would like to be able to easily use these functions where I can set dynamic value to a result of a custom function (even via a formula is fine). Today you can pass in the results of a formula. Looking at formula if it could have an option on an operand to call one of the custom functions and store that in the result value, that would work great. (For now it doesn't need to be able to browse custom functions, having to type it in works as well. Over time it would be nice to have the ability to set the different function parameters to how you do that for other blocks today - nice but not must have.) Then I can create lots of functions that can be re-used by nearly all blocks for dynamic values.

          I would definitely like to take up your offer on how to learn Library Studio via TeamViewer - that would be great. I live in Australia - so would need to work out the right timezone.

          Just a little point, the word correction maybe you could look at the word adjustment. Correction seems to indicate you did something wrong and need to correct it, or in market correction means something else. Adjustment is adjusting the value to suit. Not a biggie, just first time seeing a UI that has the word correction and it took me for a spin, like what the heck is that feature?

          On Ideas - lots of ideas for ya - will hold back the flood gates for now - we are just getting started 😉

          1 Reply Last reply Reply Quote 0
          • fxDreema
            fxDreema last edited by

            Using custom functions from inside the project... hmmm, I have to make some deep changes to the project in order to make this possible. Well, it's not impossible now at all, but not a good idea. I can't promise that I will do than soon, because it requires some deeper changes, but I can think of it.

            Now I got another idea. To make block buffers, very similar to those of custom indicators. In some way each block will be able to hold it's own set of values that can be received from next block (or all the other blocks). If such feature exists you can for example build a block to calculate some things and put the result into buffer to be read from next blocks. And you can call this block "Calculator..." or something, and it will be clearly visible as a module. Writing functions somewhere in some field is not the purpose of this platform I think.

            You can enter in Chat when you are ok to check if I am online. But actually I think you are smart enough to understand what happens in Library Studio even without my explanations.

            Adjustment or shortly Adjust sounds good. There were many people asking me what is that Correction field and I always wonder why. Well, I'm not native english and maybe I use not the best words sometimes 🙂

            1 Reply Last reply Reply Quote 0
            • T
              tiag01 last edited by

              __
              Now I got another idea. To make block buffers, very similar to those of custom indicators. In some way each block will be able to hold it's own set of values that can be received from next block (or all the other blocks). If such feature exists you can for example build a block to calculate some things and put the result into buffer to be read from next blocks. And you can call this block "Calculator..." or something, and it will be clearly visible as a module.
              [/quote:awvnnzmr]

              That would be great, that would make it very, very useful. That flexibility would allow me to create complex interactions and make modules that others could share.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post

              Online Users

              A
              C
              M
              P
              R
              S
              E
              M

              22
              Online

              146.7k
              Users

              22.4k
              Topics

              122.6k
              Posts

              Powered by NodeBB Forums | Contributors