Exit Strategy

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

    Hi Guys I’m looking to develop a code that will log the entry time a trade enters then uses that entry time to scan for a reversal and then exit.  The sequence would be:

    1. Trade meets entry conditions and trade is entered (in this example short)
    2. Time trade enters becomes a reference point
    3. Code then scans back to the reference point (Entry time) to look to exit conditions
    4. Trade closes when 3 consecutive higher highs occur (When going short) after reference point (Note scan does not include anytime prior to entry) AND trade is in profit
    5. Trade re-enters if price retraces back to original entry price and the exit conditions reset.

    I’ve attached a diagram to help explain.

    I would be grateful for any help on this?

    Kind regards

    Steve

    Screenshot-2020-05-30-at-14.58.39.png Screenshot-2020-05-30-at-14.58.39.png
    #133947 quote
    SteveawSteveaw
    Participant
    Average

    Thanks,

    I had thought of the BBC codes but they have the timeframe entered already, I’m wanting to set the time from when a trade opens at the start reference point.

    #134153 quote
    NicolasNicolas
    Keymaster
    Legend

    Not tested, but you can try with the below code (forum coding):

    if not shortonmarket and sellcondition then //condition to open your sellshort order 
     sellshort at market 
     count = 0 //reset high count 
    endif 
    
    if shortonmarket then 
     if high>high[1] then //increase highest high count 
      count=count+1
     endif 
     if count>=3 then 
      exitshort at market //exit order if highest high is >= 3 
     endif 
    else // not on market anymore 
     sellshort at tradeprice limit // put a pending limit order at the previous order entry 
    endif
    #134187 quote
    SteveawSteveaw
    Participant
    Average

    Thanks Nicolas, I’ll give this a go and see how we get on. Will let you know.

    Thanks again

    Steve

Viewing 4 posts - 1 through 4 (of 4 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

Exit Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Steveaw @steveaw Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by SteveawSteveaw
6 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/30/2020
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...