fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. KLG
    3. Posts
    • Profile
    • Following 14
    • Followers 0
    • Topics 3
    • Posts 51
    • Best 7
    • Controversial 0
    • Groups 0

    Posts made by KLG

    • RE: MT5 Close All Fast

      @jstap i tested the code in different ways its working fine , but for faster execution remove all the performance measurement, like below:
      000000000000000000000000000000000000000000000000

      for CloseAllPositions:-

      {
      sTrade.SetAsyncMode(true); // Enable asynchronous trade operations
      CloseAllPositions(); // Call function to close all positions
      }

      In the global variables section:

      #include <Trade/Trade.mqh>
      CTrade sTrade; // Trade object used for operations

      In the custom function section:
      void CloseAllPositions() {
      for (int cnt = PositionsTotal() - 1; cnt >= 0 && !IsStopped(); cnt--) {
      if (PositionGetTicket(cnt)) {
      sTrade.PositionClose(PositionGetInteger(POSITION_TICKET), 100);
      uint code = sTrade.ResultRetcode();
      Print("Close result code: ", IntegerToString(code));
      }
      }
      }

      000000000000000000000000000000000000000000000000

      for close all buy:-

      {
      sTrade.SetAsyncMode(true); // Enable asynchronous trade operations
      CloseBuyPositions(); // Call function to close only buy positions
      }

      // Global variables section:
      #include <Trade/Trade.mqh>
      CTrade sTrade; // Trade object used for operations

      // Custom function section:
      void CloseBuyPositions() {
      for (int cnt = PositionsTotal() - 1; cnt >= 0 && !IsStopped(); cnt--) {
      ulong ticket = PositionGetTicket(cnt);
      if (ticket > 0) {
      // Check if the position is a BUY
      if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) {
      sTrade.PositionClose(ticket, 100);
      uint code = sTrade.ResultRetcode();
      Print("Close BUY result code: ", IntegerToString(code));
      }
      }
      }
      }

      000000000000000000000000000000000000000000000000

      for close all sell:-

      // On tick section:
      {
      sTrade.SetAsyncMode(true); // Enable asynchronous trade operations
      CloseSellPositions(); // Call function to close only sell positions
      }

      // Global variables section:
      #include <Trade/Trade.mqh>
      CTrade sTrade; // Trade object used for operations

      // Custom function section:
      void CloseSellPositions() {
      for (int cnt = PositionsTotal() - 1; cnt >= 0 && !IsStopped(); cnt--) {
      ulong ticket = PositionGetTicket(cnt);
      if (ticket > 0) {
      // Check if the position is a SELL
      if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL) {
      sTrade.PositionClose(ticket, 100);
      uint code = sTrade.ResultRetcode();
      Print("Close SELL result code: ", IntegerToString(code));
      }
      }
      }
      }

      000000000000000000000000000000000000000000000000

      thanks again for the code👍

      posted in Questions & Answers
      KLG
      KLG
    • RE: enum MA methods

      @Dave-Sapphire You are welcome mate,
      good luck
      😊

      posted in Questions & Answers
      KLG
      KLG
    • RE: enum MA methods

      @Dave-Sapphire

      Hello mate,
      look at the example below

      MA type ENUM.jpg

      posted in Questions & Answers
      KLG
      KLG
    • RE: **Stop Loos for group/grid**

      @l-andorrà @jstap

      Thank you guys , i don't know how i did not think about it like this way 😅

      Screenshot 2024-12-15 174610.png

      sometimes taking a break will brings you hints 😊

      posted in Questions & Answers
      KLG
      KLG
    • RE: **Stop Loos for group/grid**

      @jstap @l-andorrà hello guys, thanks for the response
      i think a shared link will not help @jstap .,
      yes @l-andorrà a common SL for all trades in a group, no trade is having a SL until the 5th one is triggered a SL will be applied that will close all the positions in that group if the price line hit it.

      posted in Questions & Answers
      KLG
      KLG
    • **Stop Loos for group/grid**

      I'm confused,

      I was trying to make for example a stop lose activate after grid level #5
      in a distance of pips away from the last position of the grid

      if the price reached the SL all the grid levels will be closed on that same SL

      any one knows how to set it ?

      thank you
      @TipsyWisdom
      @l-andorrà
      @roar
      @dazmed9
      @fxDreema

      posted in Questions & Answers
      KLG
      KLG
    • RE: Cannot get value from a custom indicator. (handle=10 | error code=4806)

      i found the my mistake :S , its the candle number (-1) 😭

      posted in Questions & Answers
      KLG
      KLG
    • RE: Cannot get value from a custom indicator. (handle=10 | error code=4806)

      @l-andorrà thanks for your reply

      unfortunately it's the same

      posted in Questions & Answers
      KLG
      KLG
    • Cannot get value from a custom indicator. (handle=10 | error code=4806)

      https://fxdreema.com/shared/VWh3ntU7

      hello

      I'm getting this Error from MT5 tryin to test RSI and CCI from the condition indicators ( not custom )

      Cannot get value from a custom indicator. (handle=10 | error code=4806)

      i tried deferent values on the indicators same issue.

      I'm not sure if I'm doing it wrong 😕

      posted in Questions & Answers
      KLG
      KLG
    • RE: Testing my EA on BackTest

      2023.11.23 17:34:33.319 Core 01 2022.11.23 15:27:20 Error: Cannot get value from a custom indicator. (handle=10 | error code=4806)

      posted in Questions & Answers
      KLG
      KLG
    • Testing my EA on BackTest

      @fxDreema same with me , trying to use CCI and RSI 😕

      CPU i9 13th, is this causing the error !

      posted in Questions & Answers
      KLG
      KLG
    • 1
    • 2
    • 3
    • 3 / 3