Code to place sell and buy order at 2 levels

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #22850 quote
    Plop61
    Participant
    Average

    Hello,
    Could you help me with a bit of code ?

    Here is what I want to code :


    If the price is between “R” and “S”
    And that I am not in position, And that I have no order in progress
    Then place 1 sell order on “R” and 1 purchase order on “S”.

    If I’m in position then supress all the current order

    Thank you in advance.

    #22860 quote
    Wing
    Participant
    Veteran
    If close>S and close<R and onmarket=0 then
    buy 1 lot at S limit
    sellshort 1 lot at R limit
    endif

    Does that work?

    Nicolas thanked this post
    #22893 quote
    Plop61
    Participant
    Average

    Yes it is perfect.
    thank you very much

    #23130 quote
    Plop61
    Participant
    Average

    Good evening,
    What code should I use to take position only in 9:00 and 17:00 and close all positions at 22:00 ?
    Thank you for your reply.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Code to place sell and buy order at 2 levels


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Plop61 @plop61 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Plop61
9 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/28/2017
Status: Active
Attachments: No files
Logo Logo
Loading...