fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. RajVoCash
    R
    • Profile
    • Following 2
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    RajVoCash

    @RajVoCash

    0
    Reputation
    7
    Profile views
    1
    Posts
    0
    Followers
    2
    Following
    Joined Last Online

    RajVoCash Unfollow Follow

    Latest posts made by RajVoCash

    • ClosedProfit() function

      Can anyone help me build this function into my strategy. And how can this be done? It would be nice to find an example. I know that there are custom blocks or custom functions, but it’s not clear how to use them.

      double ClosedProfit()
      {
      uint totalNumberOfDeals = HistoryDealsTotal();
      long orderType, dealEntry;
      ulong tickerNumber =0;
      double orderProfit =0;
      double orderSwap =0;
      double PositionHistoryProfit =0;
      double CurrencyPairHistoryProfit =0;
      string mySymbol ="";
      string positionDirection ="";
      string myResult ="";
      HistorySelect(0,TimeCurrent());
      for(uint i=0; i < totalNumberOfDeals; i++)
      {
      if((tickerNumber = HistoryDealGetTicket(i))>0)
      {

      if((tickerNumber = HistoryDealGetTicket(i))>0)
      {
      orderProfit = HistoryDealGetDouble(tickerNumber,DEAL_PROFIT);
      orderSwap = HistoryDealGetDouble(tickerNumber,DEAL_SWAP);
      orderType = HistoryDealGetInteger(tickerNumber,DEAL_TYPE);
      mySymbol = HistoryDealGetString(tickerNumber,DEAL_SYMBOL);
      dealEntry = HistoryDealGetInteger(tickerNumber,DEAL_ENTRY);
      if(mySymbol == _Symbol)
      if(orderType == ORDER_TYPE_BUY || orderType == ORDER_TYPE_SELL)
      if(dealEntry == 1)
      {
      if(orderType == ORDER_TYPE_BUY)
      positionDirection = "SELL";
      if(orderType == ORDER_TYPE_SELL)
      positionDirection = "BUY";
      PositionHistoryProfit = orderProfit + orderSwap;
      CurrencyPairHistoryProfit = NormalizeDouble(CurrencyPairHistoryProfit + PositionHistoryProfit, _Digits);
      }
      }
      }
      return CurrencyPairHistoryProfit;
      }

      posted in Questions & Answers
      R
      RajVoCash