fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. DarK
    3. Topics
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 15
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by DarK

    • D

      manage manual trade per chart
      Questions & Answers • • DarK

      6
      0
      Votes
      6
      Posts
      1140
      Views

      fxDreema

      Here are all the built-in MQL4 functions designed to create, delete, modify and get information from trades and pending orders. You can see OrderMagicNumber(), OrderStopLoss(), OrderLots()... there is nothing special for the chart where the trade/order is created. Instead, Magic Number is normally used to distinguish trades from different EAs. But when you put them manually, it is 0.

      More than that, when you create a trade in one chart, it immediately appear on the other charts from the same symbol. I will say this again, when you send request to the broker to create a new trade, no information about the current chart is sent (who knows really?) and no information about this chart can be get then, when you read properties of trades and orders. Simply because there is no such property like OrderChartID().

      Anyway, the only thing that pops in my mind is the Comment property. But you need to remember to always write something there... this is not very intuitive.

    • D

      ea not working
      Questions & Answers • • DarK

      9
      0
      Votes
      9
      Posts
      1839
      Views

      fxDreema

      Oops, i thought this was fixed yesterday, I obviously forgot to upload some file. It's ok now, thanks for the report.

      I was using a new function for the new "on Chart" event that is using long datatype which is not valid in the old MT4. Also that whole "on Chart" think is not valid in it, just to mention.

    • D

      Resize option and modify variable
      Bug Reports • • DarK

      2
      0
      Votes
      2
      Posts
      499
      Views

      fxDreema

      I think I fixed this problem, it was about 2 months old.
      Now I can see that the properties of "Modify Variables" looks weird and I will go to fix it. If you mean something else, tell me.

    • D

      Compilation error on web fxdreema
      Bug Reports • • DarK

      2
      0
      Votes
      2
      Posts
      538
      Views

      fxDreema

      Is there error otherwise? I fixed some problem yesterday, but who knows, maybe another is introduced?

      The idea is that when a global variable is used in block, and that variable is with the same name with some local variable for this block (each block is a function in MQL4), then the local variable is prefixed with this "l0ca1_" thing.
      In your case, in the block is used variable named "GridStart", and you probably had Variable with the same name, so to not mix them in the function the one that is local is renamed everywhere in that function.

    • D

      Break Even
      Questions & Answers • • DarK

      2
      0
      Votes
      2
      Posts
      519
      Views

      fxDreema

      When dealing with pink blocks, especially for MT4, it's better to always use "For each Trade" somewhere above. Read the description of "For each Trade" for more details.
      Also, I think "Once per trade/order" should be placed after that condition. You have the same situation type as here: topic/2313

    • D

      Formula block - count trades of certain Group
      Questions & Answers • • DarK

      2
      0
      Votes
      2
      Posts
      910
      Views

      fxDreema

      I can see you start counting when the EA is started... or at least it looks like this. Actually you can count over the past trades and orders using "For each...." blocks. Well, now I realized that I should add option in "For each Closed Trade" to not go to very old history trades, but at least you can specify exact amount of past closed history trades to work with.

      I can suggest to define and use a variable (click Variables) instead of Formula's result variable.

      Here is a little example of how to calculate lot sizes of buys and sells: http://fxdreema.com/shared/bvrTBQFKb
      Or even better with this one: http://fxdreema.com/shared/NwqfdGorc
      this example is better because you loop trades once, and for each of them you ask for some of it's properties (in the case - it's type) before incrementing other parameter. So you can actually loop all available trades from all groups, and within the loop to check it's group number.... I think you will get it 🙂

      Read the information of these pink blocks to understand how they work. You will probably realize how this second properties panel works.
      I used "OrderLots()" which is a native MQL4 function that returns the lot size of the currently loaded trade, but you can also use "Formula" or "Condition (+Adjust field)" or "Modify Variables" to modify a variable. In these blocks the given parameter (for example lot size) is hidden somewhere in the pink "(in loop)...." category.

    • D

      restart EA with different Magic number
      Questions & Answers • • DarK

      3
      0
      Votes
      3
      Posts
      1127
      Views

      fxDreema

      There is an input parameter called "MagicStart" - this is magic number basically. But if in blocks you have Group number different than 0 (or empty), then that EA uses multiple magic numbers, because...

      magic number = MagicStart + Group number.

    • D

      Modify stop loss to be above open price
      Questions & Answers • • DarK

      2
      0
      Votes
      2
      Posts
      815
      Views

      fxDreema

      Try using "once per trade/order" just before the block that modifies SL.

    • D

      Semi Martingale with pending orders
      Questions & Answers • • DarK

      3
      0
      Votes
      3
      Posts
      1154
      Views

      D

      __Something like this, I hope: http://fxdreema.com/shared/c4T7fw43d
      This can be made using "on Trade" event as well, but this should work.
      The Pass once block is because in backtester there is no last closed trade in the beginning.
      "Check last closed trade profit" is ugly inside, sorry for that, I have to beautify it one day.
      This is probably not very well done as I created it fast, but it shows some basics and I normally prefer to show how things work instead of creating full EAs. 1 Constant and 1 Variable are used.[/quote:352vftkm]

      Thank you very much. This works and i learned alot.

      BR
      Dark

    • 1 / 1