fxDreema

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

    Unconventional Grid (Hedge or Trades Nearby)

    Questions & Answers
    3
    20
    7255
    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.
    • K
      keydcuk last edited by

      Hello,

      I am programming and EA at the moment which uses a bit of unconventional methods. There is a point in the trading where there can be a buy trade open but if the price reaches this buy trade level, I need to close out the buy and open a sell which yes, I would lose in spread.

      The issue is that I can't use groups to isolate this particular open trade to switch from buy to sell as I am using groups for something else.

      Can you think of a way that I can set a trade condition to make this trade swap of buy to sell?

      The sell order is actually a SELL STOP pending with the buy already open and I need this buy to close when the SELL STOP pending triggers. There are many buy positions open at this point so I can't group buys nor can I use another group to isolate this trade as I need to use check profit (unrealized) to close my trades.

      I use trade counts to see where I am in the grid as some levels will have 0.01 lot and others 0.02 lots. At this point where I need to make the switch, the trade counts is 3 BUY trades and 3 SELL trades when my SELL STOP triggers. I am looking afterwards to close my most profitable buy which would be the case in this system but the problem is that in some cases when the other scenario reverses I would need to close most profitable sell.

      Ideally my problem can be solved by something that will be able to identify last trade open as if last trade open is sell then close buy and if last trade open is buy then close sell. I have looked at a few blocks to try to find this solution but have been unsuccessful.

      Please help.

      Many Thanks & Best Regards,

      Daniel

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

        So you have Sell pending order somewhere and certain Buy trade must be closed at the same price at which the Sell order is trigerred. What if you have SL/TP for this Buy trade that is set to that price?

        1 Reply Last reply Reply Quote 0
        • K
          keydcuk last edited by

          __So you have Sell pending order somewhere and certain Buy trade must be closed at the same price at which the Sell order is trigerred. What if you have SL/TP for this Buy trade that is set to that price?[/quote:ivwprwy1]

          There is very little room for me using a SL or TP is this setup.

          Ideally it would need to be a "Check Last Order Opened". I know there is no such block that does this that I could find.

          Can I request that you make such a block or if you can show me something Fxdreema can do in configuration to do this?

          Many Thanks & Best Regards,

          Daniel

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

            With "For each..." blocks you can select any trade or order. Working with these blocks is something that most people don't easily understand, so here are my examples for them - https://fxdreema.com/examples/#Loop-(For-each...) Look at the options on the bottom of "For each..." blocks. If "Not more than N...." is 1, then only the latest one is selected.

            1 Reply Last reply Reply Quote 0
            • K
              keydcuk last edited by

              I think this will work fine. Thanks for your help. It is always appreciated!

              I have now encountered another problem with the way I need to close trades.

              Basically the initial close trades and delete pending orders was simple. If profit (unrealized) was achieved, then close trades and pendings.

              Here is the twist that I am looking at in Fxdreema. It seems that the software is capable of doing this but in backtest it is not working.

              What I need to do is look at the closed orders P/L against the Profit (unrealized) and close if TP reaches TPAll.

              What I have done is I have used Bucket of Closed Trades. When this block is in my configuration, I have taken the formula block and created a formula that is simply TPAll - Bucket or Trades Profit (Sum) = TPAll Variable

              The input TPAll is set at 10 pips, so if no trades opened or closed, it should come up as TPAll Variable = 10 - 0 = 10 pips

              The idea is at the moment is that with the unconventional grid, there is room to accumulate pips in between 3 grid levels. If there are pips accumulated of say 10 pips, then it will close out open positions to BE rather than waiting another 10 pips to happen in my favor of exiting either the top level or bottom level of this 3 tier grid.

              When I used the Bucket of Closed Trades and the Formula block, it seems that the Check Profits (unrealized) block is not accepting my TPAll Variable.

              In one configuration I have tried, it must be wrong as it is not closing anything at all.

              In another configuration I have tried, it seems to be closing the trades immediately after open which is rather strange as the formula is TPall - Bucket of Trades Profit (sum) = TPAll variable.

              Even at this point this trade should wait for a 10 pip profit, yet it is closing immediately.

              The only thing that I did notice is that in the formula block, it is simply stated "Bucket of Trades/Orders".

              Does this take for account closed trades as well as opened trades? Even so, the equation should still leave me to wait for 10 pips - Profits.

              If you can help me with this or if there is another way that you can think of that will help me check unrealized profit - closed P/L for an exit TP, please let me know.

              I think even if what I wanted to do worked, another problem would be to somehow isolate trade sessions as sometimes there could be 3 trades amounting to +10 pips in a session or maybe another time it could be 5 trades that accumulated +20 pips. I am looking at this as I noticed the box that counts "n" trades in the Bucket of Closed Trades block.

              Thanks,

              Daniel

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

                Now am I supposed to read all text and turn it into a project? 😕 Why don't you just show me your project. I keep repeating this over and over again to people. When there is some problem, make some simple project that shows only the problem. Ideally something that contains 2-3 blocks or as less blocks as possible. Tell me what is expected and what happens. I will try this EA, I will see the problem and I will fix the problem or tell you what can be done.

                1 Reply Last reply Reply Quote 0
                • K
                  keydcuk last edited by

                  __Now am I supposed to read all text and turn it into a project? 😕 Why don't you just show me your project. I keep repeating this over and over again to people. When there is some problem, make some simple project that shows only the problem. Ideally something that contains 2-3 blocks or as less blocks as possible. Tell me what is expected and what happens. I will try this EA, I will see the problem and I will fix the problem or tell you what can be done.[/quote:78op111i]

                  Sorry, I 100% respect what you are saying. In the future, I will provide working examples for you to better understand.

                  I rather not share a link on the forum for this part as I am working for someone who asked me to keep discretion.

                  If you look at my account and look at the EA called Unconventional Grid EA, you will see what I got.

                  I couldn't figure out how I was going to keep this to a few blocks so the whole of what I done is there. However, I am only concerned about the last 6 blocks at the very bottom level of the "on Tick" tab. The way it is configured does not work but you will clearly get an idea of what I am trying to do.

                  1. Check unrealized Profit
                  2. Check Bucket of Trades Profit/Loss (sum) of last 3 closed trades.
                    (I think this is where some of the problem might be as the formula block specifies profit of open or closed trades)
                  3. Formulate the equation Unrealized profit of "TPAll - P/L (sum) of last 3 closed trades = TPAll Variable"
                  4. If Check Profit (unrealized) is greater or = than TPAll Variable, then close all trades and delete all pending orders

                  I suppose I can talk about my next foreseen problem if we can take care of this part to work.

                  Many thanks for your support! 🙂

                  Daniel

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

                    Ok, 6 blocks. Which one of them does not work as expected?

                    1 Reply Last reply Reply Quote 0
                    • K
                      keydcuk last edited by

                      __Ok, 6 blocks. Which one of them does not work as expected?[/quote:13o2hyof]

                      The last 6 blocks.

                      ......
                      Screenshot_1.png

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

                        Please, make some project that contains only these blocks (or only blocks that are needed) to show the problem that is. This project contains almost 100 blocks. I don't know it's logic. When I put it to work I can see many trades created, but I don't know why and I don't know what to look at. I'm just lazy to even try to understand how this project works, sorry 🙂

                        Otherwise you can also use "Comment" or "Trace" to see the value of any Variable realtime. I'm pretty sure that you are capable of finding the problem. Or at least the block that does not work as expected. And this is all I want to know. I want to know if there is a block that does not work as expected, and which one is it 🙂

                        1 Reply Last reply Reply Quote 0
                        • K
                          keydcuk last edited by

                          __Please, make some project that contains only these blocks (or only blocks that are needed) to show the problem that is. This project contains almost 100 blocks. I don't know it's logic. When I put it to work I can see many trades created, but I don't know why and I don't know what to look at. I'm just lazy to even try to understand how this project works, sorry 🙂

                          Otherwise you can also use "Comment" or "Trace" to see the value of any Variable realtime. I'm pretty sure that you are capable of finding the problem. Or at least the block that does not work as expected. And this is all I want to know. I want to know if there is a block that does not work as expected, and which one is it :)[/quote:zznbsszj]

                          I don't know how to create something that is not already what it is. I'm not trying to be difficult or lazy, I just wouldn't know how to configure something else.

                          There is nothing up top that really matters of needing to know how it works other than to know that there are blocks that have a fixed TP of 10 pips and others under certain fixed conditions there are blocks that will close trades at -10 pips.

                          The scenario is simple. The start date of the backtesting 29.01.2016 on GBPUSD that I am looking at which I think this will simplify it all.

                          The EA will take trades +10 pips and - 10 pips in some places and all I want it to do is look at the last 3 closed trades.

                          At some point, the EA will be looking at the profit (unrealized) of both buys & sells. Under a normal configuration, if all (unrealized) profit is greater or equal to 10 pips as a sum of all open trades regardless of lot size or position calculated by P/L it would close all positions.

                          This particular configuration, I just want it to do the same but also take in consideration the last 3 trades.

                          I should have made it clearer as when I said 6 blocks but actually it is 12, 6 blocks on each side.
                          Only one side of the project trades in any given time so far.

                          The configuration I have used was to look at last 3 trades closed, calculate what is unrealized profit - last 3 trades closed and close all trades when unrealized profit - last 3 trades closed = 10 pips as a sum of P/L buys & sells regardless of lot size or position on the chart.

                          During the backtest, the last 3 closed trades were +10 pips, - 10 pips and +10 pips for a net sum of + 10 pips.

                          So, when the (unrealized) profit is calculated, I want it to take in consideration that it only needs to close 10 pips lower that a normal (unrealized) profit close.

                          What I have done in my current project is remove the 6 blocks I was talking about in order to replicate the normal circumstances of the trade close without taking any previous trades closed in consideration.

                          I have decided not to put the 6 blocks back as I see it pointless for you to look at if it doesn't do what it needs to do in the EA but this is the description.

                          Please do not be distracted by all the blocks as the left side only does the same thing as the right but in an opposite sense. One is for an uptrend and the other is for the downtrend.

                          ......
                          Screenshot_1.png
                          Screenshot_2.png

                          1 Reply Last reply Reply Quote 0
                          • M
                            miro1360 last edited by

                            are you trying to open trades into grid - opening against trend and wait for trend-turn into opposite direction and when it happens, close most lossable trade using profit from bucket of already profit trades?

                            Between trading and gambling is a very small gap, be careful.

                            1 Reply Last reply Reply Quote 0
                            • K
                              keydcuk last edited by

                              __are you trying to open trades into grid - opening against trend and wait for trend-turn into opposite direction and when it happens, close most lossable trade using profit from bucket of already profit trades?[/quote:34ymlzci]

                              Hi Miro,

                              I am trying to look at the last closed trades of the bucket and then use the formula of

                              Check Profit (unrealized) - Profit/Loss (sum) of bucket trades = Close All Trades & Delete All Pending Orders.

                              A bit like this" https://fxdreema.com/shared/jhJ0EvXU "

                              Basically there is profit to be taken in the middle of the grid before a scenario of close all BUYS & SELLS. If I have already made profit in the middle then the close all trades function can happen earlier. In this particular case, there was 3 trades that happened before the close all which were +10, -10 & +10.

                              I just need the EA to recognize that in the last 3 closed trades there was a net sum profit of +10 pips so that it can close trades 10 pips earlier than it would have should it have not taken profit in the middle of the grid. This occurred in the last 3 closed trades so I am using the bucket of closed trades block to look back at the last 3 trades and do the formula stated above. Somehow it looks good in the block configuration but in practice it is not executing what I need it to execute.

                              Thanks for your participation and interest.

                              PS: By the the way, are you the same Miro that hangs around the Tradingview website?

                              Daniel

                              1 Reply Last reply Reply Quote 0
                              • M
                                miro1360 last edited by

                                If I look on logic:

                                1. check profit >= TPAll ...
                                  next blocks run only when this condition is true, now it depends on your opened trades and in case how you open trades
                                  if your opened trades are +10, -10 & +10 and you have only these 3 trades and not more (depends on filter in 1. check profit), your TPAll=10, open trades profit = 10,
                                  first block pass, so now we go to 2. and 3. block

                                save profit from last 3 closed trades (say it was +10) into TPAll_Variable=TPAll-(+10) = 0

                                check profit >= 10

                                conditions meet and we close with blocks 5. and 6.

                                ....
                                back to blocks 2. + 3. with scenario
                                save profit from last 3 closed trades (say it was -50) into TPAll_Variable=TPAll-(-50) = +60
                                now your profit from open trades needs be > +60
                                check profit >= +60
                                when it is true, closing is in action

                                ....
                                back to blocks 2. + 3. with scenario
                                save profit from last 3 closed trades (say it was +50) into TPAll_Variable=TPAll-(+50) = -40
                                now your profit from open trades can be in loss to meet condition
                                check profit >= -40
                                when it is true, closign is in action - but when your actual profit from open trades is in loss - first condition is false and next conditions does not run because first is false (when TPAll=10)

                                is this logic correct?

                                (I think, you mean another Miro, I am registered on that site with same nick, but nothing posted)

                                Between trading and gambling is a very small gap, be careful.

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

                                  keydcuk, the last project that you have shared contains few blocks, but still not enough to be quickly tested 🙂 Why do you think I want you to make fully working and easily testable small example for me? Well... partly because I'm lazy to even read your questions 😄 But also because if you can do that, you already can investigate your own projects for problems. Remember, I don't want to make anyone's projects, what I want is people to master this tool fxDreema, I want you to know how to use it 🙂

                                  Now I have to add the "Buy now" blocks myself to check how these blocks work...

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

                                    This is what I wanted: https://fxdreema.com/shared/Ft2jGRvse

                                    Here I create new Buy trade on each bar with blocks 7 and 8. Blocks 9 and 10 are there to display some numbers on the screen. Block 11 (Delay) is to pause the EA for a while, so I can review the numbers.

                                    And this is what I got:
                                    http://prntscr.com/bqwas8
                                    http://prntscr.com/bqwaxx
                                    http://prntscr.com/bqwb39
                                    ... and so on

                                    If you look at the numbers, everything is working correctly, I think. Maybe the problem is in the word "Profit". On the right side in "Formula", the value can be positive or negative, because the Profit can be negative. Yes, "Profit" sounds like something that is always positive, but in this case the word is used to describe the result of the trade in money.
                                    So, depending on the Profit value, the calculation in "Formula" can flip.

                                    1 Reply Last reply Reply Quote 0
                                    • K
                                      keydcuk last edited by

                                      Thank you both.

                                      I think some of my problem is that I don't know how to register buckets of trades for the count to take place. Thank you Fxdreema admin for your example as I never would have figured it out this way. I was unaware that you needed to create a bucket of trades. I thought that as soon as you assigned any bucket of trades block that it was assigning the bucket according to the group # you would use.

                                      Here I think I can move on. I know you are not here to create EAs for people and I appreciate that 100% but I am fairly new to Fxdreema and often I use you as a last resort so I can find the answers myself by looking at other people's previous posts or sometimes I consult one of my skype friends that has used Fxdreema for a few years, but this is not a possible resource for finding an answer due the the complexity of what I am trying to have this grid EA do.

                                      What I would like to do in the next stage poses to be a bit difficult for me and am unsure whether this is possible or not.

                                      The idea is that so far I am counting trades and putting it in a bucket of closed trades and taking profit at a fixed given and taking consideration a net sum profit made by the last 3 trades.

                                      Ideally, I would like to timestamp a session from beginning to the function of close all trades.

                                      Example:

                                      First trade opens on 11.07.2016 at 12:00
                                      Profit and losses occur as the EA opens and closes trades in between the grid system but DOESN'T close all trades yet
                                      Instead of looking at last closed trades as a count of "n", is there a way to count all closed trades since 11.07.2016 at 12:00 and then if the conditions of Profit (unrealized) - bucket of closed trades (sum) profit = TPAll, CLOSE ALL TRADES and DELETE ALL PENDINGS

                                      Open conditions are simple, a new trade opens at the last profitable closed. So if the last profitable trade is a buy , it would open another buy along with my algorithm programmed in the EA.

                                      What I am looking for is that when TPAll takes and all trades close, a new timestamp is made on the next trade say 11.07.2016 at 15:39

                                      Again, profits and losses take and net sum of closed trades take place and rather than taking "n" value as last closed trades, I am looking to look at last closed trades from timestamped open session of 11.07.2016 at 15.39,

                                      Is it possible to timestamp a session and can we look at bucketed closed trades from a timestamp rather than a count of "n"?

                                      Thanks for your undivided attention. It is appreciated.

                                      Daniel

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

                                        __I was unaware that you needed to create a bucket of trades. I thought that as soon as you assigned any bucket of trades block that it was assigning the bucket according to the group # you would use.[/quote:2m1vnv8t]

                                        The idea of "Bucket" blocks is to select multiple trades/orders, so then you can get calculated values such as their total profit. I don't use the word "group" , because this word is already taken for the Group #. What a "Bucket" block do is to find the trades (considering it's filter settings) and put their ticket numbers in an array. Then in "Condition" what happens is to read that array, get these ticket numbers, load those trades again, take theirs... let's say profits, add them and give you the total profit.

                                        Also, I wanted to be able to load multiple Buckets at once, so you can compare the total profit for sells vs total profits for buys for example. But I decided that it's better to differentiate different buckets by color, not by name or number. That's why you can see these colors - Gray, Blue, Green, Red and whatever... they are only few.

                                        1 Reply Last reply Reply Quote 0
                                        • K
                                          keydcuk last edited by

                                          This is all great and thank you 100% for your help.

                                          Is there a way to timestamp a trade session in order to access bucket information from a given time?

                                          Example:

                                          {TIMESTAMP}
                                          Trades occur
                                          Bucket of trades is collecting data and placing it into an array
                                          [BUCKET OF CLOSED TRADE BLOCK]
                                          Calculate Profit/Loss (SUM) of closed trades from {TIMESTAMP} instead of "n" count of closed trades

                                          I cannot tell you enough how your software is excellent!

                                          Merci Beaucoup! (Thank you)

                                          Daniel

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

                                          Online Users

                                          A
                                          C
                                          P

                                          15
                                          Online

                                          146.7k
                                          Users

                                          22.4k
                                          Topics

                                          122.6k
                                          Posts

                                          Powered by NodeBB Forums | Contributors