Place a pending order at 1.5% from the current position

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #124858 quote
    Fran55
    Participant
    Veteran

    Hi.

    I would like to enter the market with a position.

    And leave an order placed if the price falls 1.5% enter with another position.

    I have seen that BarHunter places an order.

     

    Thanks!

    #124886 quote
    Nicolas
    Keymaster
    Master

    With a position from which side? If you want to buy lower than a previous buy order (averaging down), you can do that:

    if longonmarket then 
     buy at tradeprice*0.985 limit
    endif
    #124889 quote
    Vonasi
    Moderator
    Master

    You can set the maximum number of positions to buy easily.

    Also in this code it places a limit order at the same time that you enter the market 1.5% below the close price otherwise you don’t have an order on the market for the first candle. If there is a big gap down then you might end up with two trades opening at the start of the candle though because we can only use the closing price of the decision candle at this point.

    if not longonmarket and (your entry conditions) then
    buy 1 contract at market
    buy 1 contract at close*0.985 limit
    endif
    
    if countofposition < 3 and longonmarket then 
     buy 1 contract at tradeprice*0.985 limit
    endif
    Nicolas thanked this post
    #124894 quote
    Fran55
    Participant
    Veteran

    Ok guys… Perfect!!!

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

Place a pending order at 1.5% from the current position


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Fran55 @fran55 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Fran55
5 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/06/2020
Status: Active
Attachments: No files
Logo Logo
Loading...