Bounded Entry and Exit Rules

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #253489 quote
    Ahimsa
    Participant
    New

    Hi everyone

    Does anyone know of a proforma for bounded entry and exit condtions? That means exit rules 1 only apply if the trade was taken under entry rules 1 and exit rules 2 only apply if the trade was taken under entry rules 2.

    Many thanks in advance.

    #253498 quote
    Iván González
    Moderator
    Master

    hi. Here you have an example:

    // === Input Parameters ===
    tp1 = 20         // Take Profit for first exit
    sl1 = 40         // Stop Loss for first exit
    
    tp2 = 40         // Take Profit for second exit
    sl2 = 20         // Stop Loss for second exit
    
    
    // === Indicators ===
    avg1 = average[10](close)    // Fast moving average
    avg2 = average[50](close)    // Slow moving average
    lmax = highest[15](high) 
    
    // === Entry Logic ===
    IF NOT longonmarket AND avg1 CROSSES OVER avg2 THEN
    type = 1
    
    BUY 1 CONTRACT AT MARKET
    
    SET STOP PLOSS sl1
    SET target Pprofit tp1
    elsif not longonmarket AND close crosses over lmax[1] THEN
    type = 2
    BUY 1 CONTRACT AT MARKET
    
    SET STOP PLOSS sl2
    SET target Pprofit tp2
    elsif not onmarket then
    type = 0
    ENDIF
    
    // === Plotting indicators and levels on chart ===
    graphonprice avg1 coloured("red")
    graphonprice avg2 coloured("blue")
    graphonprice lmax coloured("green")
    graph type
    
    robertogozzi thanked this post
    #253642 quote
    Ahimsa
    Participant
    New

    Thank you Ivan.

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

Bounded Entry and Exit Rules


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Ahimsa @ahimsa Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Ahimsa
3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/10/2025
Status: Active
Attachments: No files
Logo Logo
Loading...