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 3743
Next
In Process
setborg
setborg

setborg

  • 3 Questions
  • 3 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
setborg
Asked: December 26, 20202020-12-26T13:49:01+00:00 2020-12-26T13:49:01+00:00In: Forex Expert Advisors

Pending order on MQL5

  • 0

Good afternoon, I need help in placing a limited buy order for bars. Ie if you take the timeframe D1, then you need to place a buy order above the high of yesterday.

I attach the code. How to describe this procedure correctly ?

void OnStart()
  {
   double   open1  =  iOpen(Symbol(),Period(),1);
   double   close1 =  iClose(Symbol(),Period(),1);
   double   high1  =  iHigh(Symbol(),Period(),1);
   double   low1   =  iLow(Symbol(),Period(),1);

// Create a request
MqlTradeRequest  request = {0};
         request.action = TRADE_ACTION_PENDING;
         request.symbol = Symbol();
         request.volume = 0.1;
         request.price  = SymbolInfoDouble(request.symbol,SYMBOL_ASK)-1000*_Point;
         request.sl     = request.price-500*_Point;
         request.tp     = request.price+100*_Point;
         request.type   = ORDER_TYPE_BUY_LIMIT;
         request.type_filling = ORDER_FILLING_FOK;
         request.expiration = ORDER_TIME_DAY;

MqlTradeResult result = {0};
if (OrderSend (request,result))
    Print ("Order sent successfully, no errors=", GetLastError());
else
        Print ("Failed to send request, error =", GetLastError());
}

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

    3 Answers

    • Voted
    • Oldest
    • Recent
    1. prostotrader

      prostotrader

      • 0 Questions
      • 16 Answers
      • 0 Best Answers
      • 56 Points
      View Profile
      prostotrader
      2020-12-26T13:49:17+00:00Added an answer on December 26, 2020 at 1:49 pm

      Pending order on MQL5

      Is there an order that will not work immediately, but will be located in the glass?

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

      setborg

      • 3 Questions
      • 3 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      setborg
      2020-12-26T13:49:09+00:00Added an answer on December 26, 2020 at 1:49 pm

      Alexey Viktorov:

      Instead of Period (), put PERIOD_D1 and specify the resulting value as the price.

      Can you at least write an example ?

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

      alexeyvik

      • 1 Question
      • 74 Answers
      • 0 Best Answers
      • 172 Points
      View Profile
      alexeyvik
      2020-12-26T13:49:05+00:00Added an answer on December 26, 2020 at 1:49 pm

      setborg:

      Good afternoon, I need help in placing a limited buy order for bars. Ie if you take the timeframe D1, then you need to place a buy order above the high of yesterday.

      I attach the code. How to describe this procedure correctly ?

      Instead of Period (), put PERIOD_D1 and specify the resulting value as the price.

      • 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