Extending a limit order

Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • #215100 quote
    Mike BoormanMike Boorman
    Participant
    Average

    I’ve updated the code but I knew immediately that it wouldn’t generate the entry signal – it is my fault because I don’t know how to define “Definitehigh” properly. Doing it as “highest[10]” when the market is rising will use a bar that is too recent. In the case of the screengrab, the highest in the range of 10 is simply the previous bar, which isn’t what I want. I need it to look back to find the high that was previously the highest before the market went upwards (at 10:25am on the screengrab). It’s similar to how someone would look back a certain number of bars to find a significant high in a divergence system. How would I do this?

     

    StartTime = 080000
    Limitentrytime = 230000
    
    daysforbiddenentry = OpenDayOfWeek=6 OR OpenDayOfWeek=0
    Definitehigh=highest[10](high)
    
    ONCE Signal = 0
    Ema15       = average[15,1](close)
    IF high > (definitehigh[1] + 7) THEN
    Signal = 1
    ENDIF
    IF close < Ema15 THEN
    Signal = 0
    ENDIF
    IF Not OnMarket AND Signal AND ((low <= Ema15) AND (min(open,close) >= Ema15)) and time >=StartTime and time <=LimitEntrytime and not daysForbiddenEntry THEN
    BUY 1 perpoint at Market
    SET STOP    pLOSS 16
    SET TARGET pPROFIT 5
    ENDIF
    
    graph definitehigh[1]
    
    Screen-Shot-2023-05-23-at-10.11.34-1.png Screen-Shot-2023-05-23-at-10.11.34-1.png
    #215335 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You can use a LookBack period to shift the search leftwards:

    LookBack = 10
    Definitehigh=highest[10](high[LookBack])
Viewing 2 posts - 16 through 17 (of 17 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Extending a limit order


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 16 replies,
has 3 voices, and was last updated by robertogozzirobertogozzi
3 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/03/2023
Status: Active
Attachments: 8 files
ProRealCode ProRealCode
Loading...