fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. General Melchett
    • Profile
    • Following 0
    • Followers 1
    • Topics 30
    • Posts 79
    • Best 6
    • Controversial 0
    • Groups 0

    General Melchett

    @General Melchett

    10
    Reputation
    384
    Profile views
    79
    Posts
    1
    Followers
    0
    Following
    Joined Last Online
    Location Northampton

    General Melchett Unfollow Follow

    Best posts made by General Melchett

    • RE: Trade Profit/loss at certain price level

      Thank you @l-andorrà , just the hint I needed.

      If anyone is interested you can set price per pip variable with this calculation
      0_1644433956892_2022-02-09 21_11_10-Clipboard.png

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Weekday filter constants

      I know this is an old topic but I went around in circles thinking the reply above was valid.

      It is not correct: the boolean function DOES work and is expected for the weekday.

      So Tuesday boolean value of 'false' means 'Reject'

      posted in Questions & Answers
      General Melchett
      General Melchett
    • Kestra constantly DMs me, please someone stop him

      Is @kestra DMing everyone else with requests to save his work for him? Unfortunately I can't block him but have reported his profile a few weeks ago but nothing has been done. Just pay for a subscription @kestra then you will be able to save your work.

      Can one of the admins @fxdreema @l-andorrà please ban him
      0_1652552204630_2022-05-14 21_12_57-Clipboard.png

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Track multiple instruments/pairs with one EA instance?

      Wow I never knew about that block! Thank you @jstap !

      (For those that are curious it's under 'controlling blocks':

      image.png)

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Which of this models is best to test EAS?

      you need to understand what the different types are, especially if it's a scalper
      https://www.youtube.com/watch?v=qqVoHMg-Q_Y

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Compilation errors 'return' - function must return a value

      This happened to me just now.

      Error message looks like this and is very difficult to debug:
      0_1632734667206_compil erors.png

      It happened as in a comments (ugly) box a data row had a value of text (code). Even though the label was blank and there was no code in the box the error came up. So I changed it back to the default of 'Numeric' and it compiled successfully.

      posted in Questions & Answers
      General Melchett
      General Melchett

    Latest posts made by General Melchett

    • RE: Have had to use iCustom to get Heiken Ashi to work

      I complained about this a while back but didn't file a report - thanks for sharing your icustom solution

      posted in Bug Reports
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      @l-andorrà no it will only work for buys, that's a hedged trade, no?

      But it might be worth asking ChatGPT as it can come up with a calculation/formula for you

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Which of this models is best to test EAS?

      you need to understand what the different types are, especially if it's a scalper
      https://www.youtube.com/watch?v=qqVoHMg-Q_Y

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      Be wary of using chatGPT as it took me a while to get to this formula.

      For example, some of the maths was completely out - I gave it 'real life' figures based on watching strategy tester (as it was working with TP based on profit, rather than price). Then it corrected itself.

      But you can also just say 'now give it to me as MQL5' and it spits out code for you, so that's pretty handy

      double CalculateTakeProfitPriceForBuy(double P_A, double P_D, double x_pips)
      {
          double lot_size_A = 0.02;
          double lot_size_D = 0.06;
          double pip_size = 0.0001;  // Standard pip size for major pairs like EURUSD
          
          return (lot_size_A * P_A + lot_size_D * P_D + x_pips * pip_size * (lot_size_A + lot_size_D)) / (lot_size_A + lot_size_D);
      }
      
      // Sample usage:
      void OnTick()
      {
          double P_A = 1.09692;  // Opening price of trade A
          double P_D = 1.09592;  // Opening price of trade D
          double x_pips = 3.0;   // Desired profit in pips
          
          double TP_Price = CalculateTakeProfitPriceForBuy(P_A, P_D, x_pips);
          
          // Use the TP_Price as necessary, e.g., set a take profit order, draw a line on chart, etc.
          // ... your logic here ...
      }
      
      
      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      A little more on the formula (buys only)

      image.png

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      This is bizarre.
      I have 2 formulas to trace bug on why calc isn't working. One that uses custom pip size (0.0001) and one that uses original (0.00001). Identical formulas bar the 1 decimal place. But fxdreema seems to be unable to calculate the one with the extra decimal place. Just completely ignores it. And it's not the variable, I've tried hardcoding the 0.00001 as well. Very strange.

      This formula seems to work weirdly I can't get the calculation to work. It simple refuses to multiply by 0.00001. Tried it an MQL5 code block and output to journal. No dice.

      image.png

      It's soooo close. The above is the solution but I have spent so long on this now for some visual flair I think I'll just leave it.

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      Also remember the TP in pips is of the first/last trades total lot size. The oldest trade is almost certainly in drawdown when it's closed (but the two together close in profit)

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      Never knew you could draw lines straight from TP!

      But I don't think that'll work - it works on bucket, right? For bucket you can only filter by direction or manual/automated. By loop you could do it (count buys, then only count every (totaltrades -1)) but then you can't calc the aggregated TP of the 2 trades (remember, this could be the first/last trades of a batch of 10+)

      ChatGPT's approach is to proportionally measure each trade's contribution to profit by point, and take into account the starting price of each, which is how it would've been in my head but I had no idea what formula would be.

      I've nearly done it but the maths/formula is tripping me up, particularly point size as I want it to work on metals/FX/indices. I'm so close, I have the correct TP now but it's multiplied it by 10 somewhere. I'll post formula when I've cracked it.

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      @TipsyWisdom it is, super easy.

      BUT, I would like to display the TP as a line on the chart, and I can only do this (as far as I know) by calculating the price that the TP line should be.

      posted in Questions & Answers
      General Melchett
      General Melchett
    • RE: Calculate TP (price) for 2 trades of different lot sizes

      ChatGPT has this to say. I'm going to take a look at this closely a little later (it's for a sell):

      (Deleted pic as formula was wrong)

      posted in Questions & Answers
      General Melchett
      General Melchett