duration of order for longer then 1 bar

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #100562 quote
    Jaldidee
    Participant
    Average

    Hello,

    Last time here I got help with setting my target and profits at the high and low of the bar.

    For the next stage of the code I want that when a order is put in at the high of the bar the order is longer valid then just one bar.

    I looked at the programming guide for the rigt codes, but I just cant seem to get it to work.

    What am I doing wrong?

    ONCE Nbbarlimit = 10
    
    var1 = ExponentialAverage[20](close)>= ExponentialAverage[100](close)
    var2 = High[0] < High[1]
    var3 = Low[0] > Low[1]
    mybuy = high[1]
    myindex = barindex
    
    If barindex >= myindex + Nbbarlimit THEN
    mybuy = 0
    endif
    
    // Conditions to enter long positions
    IF not onmarket and (mybuy > 0) and var1 AND var2 AND var3 AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT mybuy STOP
    mystop = low[1]
    mytarget = high[1] + (2*(high[1]-low[1]))
    ENDIF
     
    if onmarket then
    sell at mystop stop
    sell at mytarget limit
    endif
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

duration of order for longer then 1 bar


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Jaldidee @jaldidee Participant
Summary

This topic contains 1 voice and has 0 replies.

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