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 5801
Next
In Process
creepystaisy97
creepystaisy97

creepystaisy97

  • 1 Question
  • 2 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
creepystaisy97
Asked: December 29, 20202020-12-29T10:07:55+00:00 2020-12-29T10:07:55+00:00In: Forex Expert Advisors

Help with a simple script

  • 0

Good afternoon, I want to run the script in 2 steps:
1. The script opens two pending orders buystop and sellstop;
2. as soon as the price touches one of the orders,the “opposite” one is removed(for example, a buystop is opened,a sellstop is removed);
If I had no problems with the first step,then with the second….
Please tell me how to implement step 2 correctly.I heard that you can do this through the standard cycle of iterating orders (for (int i=orderstotal()-1; i>=0; i–) until> some does not fit the magic number,but how to implement this I do not understand.
I will be glad of any help and any advice.Thank you in advance.

  • 5 5 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    5 Answers

    • Voted
    • Oldest
    • Recent
    1. creepystaisy97

      creepystaisy97

      • 1 Question
      • 2 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      creepystaisy97
      2020-12-29T10:08:29+00:00Added an answer on December 29, 2020 at 10:08 am

      Alexey Viktorov:

      Doing this in a script is absolutely wrong. In this case, you will have to loop the script, which is not welcome. But if you do this in the Expert Advisor, the algorithm is quite simple:

      1. When opening orders, their tickets are stored in different variables or in an array.
      2. At each tick, orders are selected in turn and the order type is checked.
      3. If OP_BUY or OP_SELL means the second one is deleted and expertremove () is either waiting for the next command…

      Good afternoon again, thank you for describing the steps.Tell me a little more please.here is such a situation,the first step I have is this-the script opens with the onset of a certain time,two orders.Can I leave step 1 as a script and make step 2 as an Expert Advisor?And if so, how?Or maybe it would be better to do all the steps with one Expert Advisor?Thank you in advance:)))

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

      alexeyvik

      • 1 Question
      • 74 Answers
      • 0 Best Answers
      • 172 Points
      View Profile
      alexeyvik
      2020-12-29T10:08:23+00:00Added an answer on December 29, 2020 at 10:08 am

      creepystaisy97:

      Good afternoon, I want to run the script in 2 steps:

      1. The script opens two pending orders buystop and sellstop;

      2. as soon as the price touches one of the orders,the “opposite” one is removed(for example, a buystop is opened,a sellstop is removed);

      If I had no problems with the first step,then with the second….

      Please tell me how to implement step 2 correctly.I heard that you can do this through the standard cycle of iterating orders (for (int i=orderstotal()-1; i>=0; i–) until> some does not fit the magic number,but how to implement this I do not understand.

      I will be glad of any help and any advice.Thank you in advance.

      Doing this in a script is absolutely wrong. In this case, you will have to loop the script, which is not welcome. But if you do this in the Expert Advisor, the algorithm is quite simple:

      1. When opening orders, their tickets are stored in different variables or in an array.
      2. At each tick, orders are selected in turn and the order type is checked.
      3. If OP_BUY or OP_SELL means the second one is deleted and expertremove () is either waiting for the next command…
      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    3. 0aleksandr0

      0aleksandr0

      • 0 Questions
      • 2 Answers
      • 0 Best Answers
      • 24 Points
      View Profile
      0aleksandr0
      2020-12-29T10:08:17+00:00Added an answer on December 29, 2020 at 10:08 am

      creepystaisy97:

      Thank you very much for your help.Only I (a leaky head) forgot to specify that I write in mql4.Sorry for wasting your time,I’ll try to redo the first part of the code for mql5, so that your work is not in vain

      I didn’t overdo it)
      Copied from my Expert Advisor, there is a similar functionality just)

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    4. creepystaisy97

      creepystaisy97

      • 1 Question
      • 2 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      creepystaisy97
      2020-12-29T10:08:08+00:00Added an answer on December 29, 2020 at 10:08 am

      0Aleksandr0:

      is it mql5?

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    5. 0aleksandr0

      0aleksandr0

      • 0 Questions
      • 2 Answers
      • 0 Best Answers
      • 24 Points
      View Profile
      0aleksandr0
      2020-12-29T10:08:01+00:00Added an answer on December 29, 2020 at 10:08 am

      creepystaisy97:

      Good afternoon, I want to run the script in 2 steps:

      1. The script opens two pending orders buystop and sellstop;

      2. as soon as the price touches one of the orders,the “opposite” one is removed(for example, a buystop is opened,a sellstop is removed);

      If I had no problems with the first step,then with the second….

      Please tell me how to implement step 2 correctly.I heard that you can do this through the standard cycle of iterating orders (for (int i=orderstotal()-1; i>=0; i–) until> some does not fit the magic number,but how to implement this I do not understand.

      I will be glad of any help and any advice.Thank you in advance.

      If there are no open positions before any of the orders are triggered, then I would build in an infinite loop checking the open position, and delete the remaining orders:

      • 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