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
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
Home/ Questions/Q 4711
Next
In Process
izlio
izlio

izlio

  • 1 Question
  • 0 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
izlio
Asked: December 27, 20202020-12-27T05:28:19+00:00 2020-12-27T05:28:19+00:00In: Forex Expert Advisors

Sell Stop Error

  • 0

I want to create a Sell Stop order, for this I use CTrade, according to the logic (mine, it may not be correct) to place this order, we create a condition where the bid must be greater than the price. Hence Take Profit = price – take profit in points and Stop Loss = price + stop loss in points (values in points are entered because I count from the opening price of price). 

As a result, I get invalid price or invalid stops. If it is not difficult, give an example specifically for SellStop().

Thank you for your attention, I understand that the question is probably too simple and obvious, but for a day I did not understand what the error is.

  • 3 3 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    3 Answers

    • Voted
    • Oldest
    • Recent
    1. ivanbg

      ivanbg

      • 0 Questions
      • 5 Answers
      • 0 Best Answers
      • 30 Points
      View Profile
      ivanbg
      2020-12-27T05:28:32+00:00Added an answer on December 27, 2020 at 5:28 am

      rosomah:

      SYMBOL_TRADE_STOPS_LEVEL

      Minimum margin in points from the current closing price for setting Stop orders

      int

      int

      Specifies the number of points . You need to write it like this :

      double stopLevel = _Point*SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL);

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. rosomah

      rosomah

      • 0 Questions
      • 5 Answers
      • 0 Best Answers
      • 30 Points
      View Profile
      rosomah
      2020-12-27T05:28:28+00:00Added an answer on December 27, 2020 at 5:28 am

      Andy Sanders:

      SYMBOL_TRADE_STOPS_LEVEL

      Minimum margin in points from the current closing price for setting Stop orders

      int

      int

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    3. arteinvolo

      arteinvolo

      • 0 Questions
      • 5 Answers
      • 0 Best Answers
      • 30 Points
      View Profile
      arteinvolo
      2020-12-27T05:28:23+00:00Added an answer on December 27, 2020 at 5:28 am

      1. stop orders are placed only OUTSIDE the spread
      2. a stop order for buying is always at the ASK price, for selling-BID
      3. in addition, in Forex kitchens, in order not to be pipped, they came up with such a concept as Stop Level, the minimum size of a stop loss order, it SHOULD be larger than the spread, so if the opening for the purchase by ASK, then the stop loss is placed below the BID, and Vice versa

      code without checking, for the exact name of the constants-in Google and documentation

      string symbol = Symbol();

      double ask = SymbolInfoDouble(symbol, SYMBOL_ASK);
      double bid = SymbolInfoDouble(symbol, SYMBOL_BID);
      double step = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE);
      double stopLevel = SymbolInfoDouble(symbol, SYMBOL_TRADE_STOPS_LEVEL);

      // Buy

      double buyPrice = ask; / / buy at a price ABOVE the spread
      double buyStop = bid-step; / / stop loss at the lower limit of the spread minus 1 point
      double buyProfit= ask + step; / / take profit 1 point above the upper limit of the spread

      buyStop = MathMin(buyStop, bid-stopLevel); / / check that the stop loss is exactly LOWER than the one allowed by the dealer

      OrderSend( ... ORDER_TYPE_BUY ... )

      // Sell

      double sellPrice = bid; / / sell at a price BELOW the spread
      double sellStop = ask + step; / / stop loss on the upper limit + 1 point
      double sellProfit= bid-step; / / take profit 1 point below the spread

      sellStop = MathMax(sellStop, ask + stopLevel); / / check that the stop loss is exactly HIGHER than allowed by the dealer

      OrderSend( ... ORDER_TYPE_SELL ... )

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    Stats

    • Questions 504
    • Answers 2k
    • Posts 5
    • Comments 0
    • Best Answers 0
    • Users 681
    • 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

    Related Questions

    • Brus Agell

      Правельный выбор

      • 0 Answers
    • pinupcasinoo

      Pin Up Casino

      • 0 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 2 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 0 Answers
    • c00l777

      Optimization results differ on different accounts

      • 3 Answers

    Users

    Leonardcig

    Leonardcig

    • 0 Questions
    • 0 Answers
    DennisByday

    DennisByday

    • 0 Questions
    • 0 Answers
    Haroldmeary

    Haroldmeary

    • 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