Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

First independent community of traders

First independent community of traders Logo First independent community of traders Logo

First independent community of traders Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • Buy Theme
  • Home
  • About Us
  • Blog
  • Contact Us

barabashkakvn

Ask barabashkakvn
0Followers
7Questions
Home/ barabashkakvn/Answers
  • About
  • Questions
  • Polls
  • Answers
  • Best Answers
  • Followed Questions
  • Favorite Questions
  • Groups
  1. Asked: January 27, 2021In: Forex Expert Advisors

    You need to write an Expert Advisor on the indicator

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:23 am

    You will be helped in the Freelance service.

    You will be helped in the Freelance service.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  2. Asked: January 27, 2021In: Forex Expert Advisors

    Opening an order in the opposite direction

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:20 am

    miron_like: Please tell me, what can I do based on my code, so as not to rewrite it?No, you can't.

    miron_like:

    Please tell me, what can I do based on my code, so as not to rewrite it?

    No, you can’t.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  3. Asked: January 27, 2021In: Forex Expert Advisors

    Opening an order in the opposite direction

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:19 am

    miron_like: I looked at your example. Frankly speaking, while there is not enough knowledge to fully understand it and then write it as it should. Can you tell me how to implement this task based on this code?To get started, just take an example and remove all the extra stuff - what you don't need.

    miron_like:

    I looked at your example. Frankly speaking, while there is not enough knowledge to fully understand it and then write it as it should. 

    Can you tell me how to implement this task based on this code?

    To get started, just take an example and remove all the extra stuff – what you don’t need.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  4. Asked: January 27, 2021In: Forex Expert Advisors

    Opening an order in the opposite direction

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:19 am

    miron_like: And so the code in its full form looks right?...No, it's not right. You caught a transaction with the TRADE_TRANSACTION_DEAL_ADD type - this is adding a transaction to the history, please note that there is no mention of an order here. Forget about the orders. There are only positions. NRead more

    miron_like:

    And so the code in its full form looks right?

    …

    No, it’s not right. You caught a transaction with the TRADE_TRANSACTION_DEAL_ADD type – this is adding a transaction to the history, please note that there is no mention of an order here. Forget about the orders. There are only positions.

    Next, see that the transaction must have the DEAL_REASON_SL property – again, the transaction, orders do not even smell.

    Now it remains to open a position:

    Forum on trading, automated trading systems and testing of trading strategies

    Opening an order in the opposite direction

    Vladimir Karputov, 2017.07.27 14:05

    And for an example of opening a position (namely, a position, and not placing a pending order), see the same code that I gave (the OpenBuy and OpenSell functions).

    To begin with, just write the code in which it opens a position after you find the trade that appeared as a result of the Stop loss trigger – then, when I see your code, I will tell you further.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  5. Asked: January 27, 2021In: Forex Expert Advisors

    Opening an order in the opposite direction

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:19 am

    miron_like: long     deal_reason       =-1; deal_reason=HistoryDealGetInteger(trans.deal,DEAL_REASON); if(deal_reason==DEAL_REASON_SL) and here is what I need...Am I right?"Yes. That's right.

    miron_like:

    long     deal_reason       =-1;
    deal_reason=HistoryDealGetInteger(trans.deal,DEAL_REASON);
    if(deal_reason==DEAL_REASON_SL)
    and here is what I need...

    Am I right?”

    Yes. That’s right.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  6. Asked: January 27, 2021In: Forex Expert Advisors

    Opening an order in the opposite direction

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:18 am

    miron_like: Please tell me, when closing an order for StopLoss, I need to open an order in the opposite direction with the same parameters, but once. I.e. if the first order was closed for SL, then for subsequent closed orders for SL, do not open an order in the opposite direction.Example of how toRead more

    miron_like:
    Please tell me, when closing an order for StopLoss, I need to open an order in the opposite direction with the same parameters, but once. I.e. if the first order was closed for SL, then for subsequent closed orders for SL, do not open an order in the opposite direction.

    Example of how to catch a 100% guaranteed trade as a result of triggering the Stop Loss code Stop Loss Take Profit – in OnTradeTransaction, catch a trade that is closed as a result of the Stop loss trigger (the DEAL_REASON_SL property of the trade). 

    After you have caught a closed trade as a result of the Stop Loss trigger, you can already do what you need.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  7. Asked: January 27, 2021In: Forex Expert Advisors

    The invalid price error is thrown

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:16 am

    Don't understand how you are when using the method NormalizePrice  of the CSymbolInfo class, do you get prices that do not end in "0"on this symbol in SL and TP? You have both "1" and "9" there.Second: put these prints://+------------------------------------------------------------------+ //| Open BRead more

    Don’t understand how you are when using the method NormalizePrice  of the CSymbolInfo class, do you get prices that do not end in “0”on this symbol in SL and TP? You have both “1” and “9” there.

    Second: put these prints:

    //+------------------------------------------------------------------+
    //| Open Buy position                                                |
    //+------------------------------------------------------------------+
    void OpenBuy(double lot,double sl,double tp)
      {
       sl=m_symbol.NormalizePrice(sl);
       tp=m_symbol.NormalizePrice(tp);

       double volume=LotCheck(lot);
       if(volume==0.0)
          return;
    //--- check volume before OrderSend to avoid "not enough money" error (CTrade)
       double check_volume_lot=m_trade.CheckVolume(m_symbol.Name(),volume,m_symbol.Ask(),ORDER_TYPE_BUY);

       if(check_volume_lot!=0.0)
          if(check_volume_lot>=volume)
            {
             if(m_trade.Buy(volume,NULL,m_symbol.Ask(),sl,tp))
               {
                if(m_trade.ResultDeal()==0)
                  {
                   Print("Buy -> false. Result Retcode: ",m_trade.ResultRetcode(),
                         ", description of result: ",m_trade.ResultRetcodeDescription(),
                         ", Bid: ",DoubleToString(m_symbol.Bid(),m_symbol.Digits()),
                         ", Ask: ",DoubleToString(m_symbol.Ask(),m_symbol.Digits()),
                         ", Last: ",DoubleToString(m_symbol.Last(),m_symbol.Digits()));
                  }
                else
                  {
                   Print("Buy -> true. Result Retcode: ",m_trade.ResultRetcode(),
                         ", description of result: ",m_trade.ResultRetcodeDescription(),
                         ", Bid: ",DoubleToString(m_symbol.Bid(),m_symbol.Digits()),
                         ", Ask: ",DoubleToString(m_symbol.Ask(),m_symbol.Digits()),
                         ", Last: ",DoubleToString(m_symbol.Last(),m_symbol.Digits()));
                  }
               }
             else
               {
                Print("Buy -> false. Result Retcode: ",m_trade.ResultRetcode(),
                      ", description of result: ",m_trade.ResultRetcodeDescription(),
                      ", Bid: ",DoubleToString(m_symbol.Bid(),m_symbol.Digits()),
                      ", Ask: ",DoubleToString(m_symbol.Ask(),m_symbol.Digits()),
                      ", Last: ",DoubleToString(m_symbol.Last(),m_symbol.Digits()));
               }
            }
    //---
      }
    //+------------------------------------------------------------------+
    //| Open Sell position                                               |
    //+------------------------------------------------------------------+
    void OpenSell(double lot,double sl,double tp)
      {
       sl=m_symbol.NormalizePrice(sl);
       tp=m_symbol.NormalizePrice(tp);

       double volume=LotCheck(lot);
       if(volume==0.0)
          return;
    //--- check volume before OrderSend to avoid "not enough money" error (CTrade)
       double check_volume_lot=m_trade.CheckVolume(m_symbol.Name(),volume,m_symbol.Bid(),ORDER_TYPE_SELL);

       if(check_volume_lot!=0.0)
          if(check_volume_lot>=volume)
            {
             if(m_trade.Sell(volume,NULL,m_symbol.Bid(),sl,tp))
               {
                if(m_trade.ResultDeal()==0)
                  {
                   Print("Sell -> false. Result Retcode: ",m_trade.ResultRetcode(),
                         ", description of result: ",m_trade.ResultRetcodeDescription(),
                         ", Bid: ",DoubleToString(m_symbol.Bid(),m_symbol.Digits()),
                         ", Ask: ",DoubleToString(m_symbol.Ask(),m_symbol.Digits()),
                         ", Last: ",DoubleToString(m_symbol.Last(),m_symbol.Digits()));
                  }
                else
                  {
                   Print("Sell -> true. Result Retcode: ",m_trade.ResultRetcode(),
                         ", description of result: ",m_trade.ResultRetcodeDescription(),
                         ", Bid: ",DoubleToString(m_symbol.Bid(),m_symbol.Digits()),
                         ", Ask: ",DoubleToString(m_symbol.Ask(),m_symbol.Digits()),
                         ", Last: ",DoubleToString(m_symbol.Last(),m_symbol.Digits()));
                  }
               }
             else
               {
                Print("Sell -> false. Result Retcode: ",m_trade.ResultRetcode(),
                      ", description of result: ",m_trade.ResultRetcodeDescription(),
                      ", Bid: ",DoubleToString(m_symbol.Bid(),m_symbol.Digits()),
                      ", Ask: ",DoubleToString(m_symbol.Ask(),m_symbol.Digits()),
                      ", Last: ",DoubleToString(m_symbol.Last(),m_symbol.Digits()));
               }
            }
    //---
      }

    Errors occur when: the opening price of the position does not match the Last price and the Last is equal to the stop (SL or TP).

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  8. Asked: January 27, 2021In: Forex Expert Advisors

    The invalid price error is thrown

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:16 am

    Fresto: 10. The prices of the RTS instrument are multiples of 10.No, you check by gluing, not by RTS.

    Fresto:

    10. The prices of the RTS instrument are multiples of 10.

    No, you check by gluing, not by RTS.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  9. Asked: January 27, 2021In: Forex Expert Advisors

    The invalid price error is thrown

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:16 am

    Fresto: I created the object. And with each new call to the onTick() function, I call the Refresh method. Just the most interesting thing is that in the position opening code everything is assigned in real time and why then the first orders pass, and the others do not.. First, it writes that invalidRead more

    Fresto:

    I created the object. And with each new call to the onTick() function, I call the Refresh method. Just the most interesting thing is that in the position opening code everything is assigned in real time and why then the first orders pass, and the others do not.. First, it writes that invalid_price, then it also intersects with invalid_stop. Although I have been optimizing the exact same position opening code on other Expert Advisors for a long time, and everything is fine there.

    P. s. is there any way to find out why this particular error crashes? Not just-invalid_price, but more specifically, what is the problem? 

    I think this is the imposition of a ban on trading on gluing. No more thoughts.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  10. Asked: January 27, 2021In: Forex Expert Advisors

    The invalid price error is thrown

    barabashkakvn

    barabashkakvn

    • 7 Questions
    • 175 Answers
    • 0 Best Answers
    • 340 Points
    View Profile
    barabashkakvn
    Added an answer on January 27, 2021 at 7:16 am

    So this is gluing - is it allowed to trade on it?

    So this is gluing – is it allowed to trade on it?

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
1 2 3 … 18

Sidebar

Ask A Question

Stats

  • Questions 530
  • Answers 2k
  • Posts 5
  • Comments 0
  • Best Answers 0
  • Users 754
  • Popular
  • Comments
  • Tags
  • forexcommunity

    Highlighting what’s important about questions & Answers on Discy Community!

    • 0 Comments
  • forexcommunity

    Introducing Keyboard Shortcuts, our first Labs feature

    • 0 Comments
  • forexcommunity

    Defining quality on Discy Engine — what a helpful answer ...

    • 0 Comments
  • forexcommunity

    Organizational and company accounts on Discy Engine the next step

    • 0 Comments
  • forexcommunity

    Hello world!

    • 0 Comments

Users

JeffreyPew

JeffreyPew

  • 0 Questions
  • 0 Answers
Jamesdah

Jamesdah

  • 0 Questions
  • 0 Answers
Michaelnaw

Michaelnaw

  • 0 Questions
  • 0 Answers

Footer

First independent community of traders

About

An independent community of forex traders. This is where traders communicate. You can ask your questions and you will receive an answer to your question.
  • Terms of Use
  • Privacy Policy
  • Cookie Policy
  • Knowledge Base
  • Support

© 2021 Forexcommunity.net. All Rights Reserved