Check profit hit

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #182974 quote
    joeyp101
    Participant
    New

    Hello,

    Below is a snippet of my code. In this strategy if the trade hits stoploss it’ll re-enter in the opposite direction (max 2 trades per day). I’ve now added a trailing stop, however I still want the opposite trade to execute as long as it hasn’t hit “SET TARGET pPROFIT”. So at the moment, if it hits the trailing stop in profit nothing happens, but I want it to re-enter.

    Hope that makes sense, any help much appreciated.

    // Conditions to enter short positions
    c2 = (lpm[1] >= close)
    
    IF c2 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry AND count<1  THEN
    SELLSHORT 3.75 PERPOINT AT MARKET
    SET STOP pLOSS 2
    SET TARGET pPROFIT 13
    count = count + 1
    ENDIF
    
    //check profit
    If StrategyProfit < StrategyProfit[1] then
    If LongOnMarket[1] AND Not OnMarket AND count=1 then
    Sellshort 3.75 PERPOINT AT MARKET
    SET STOP pLOSS 3
    SET TARGET pPROFIT 10
    count = count + 1
    Elsif shortonmarket[1] AND Not OnMarket and count=1 then
    BUY 3.75 PERPOINT AT MARKET
    SET STOP pLOSS 3
    SET TARGET pPROFIT 10
    count = count + 1
    Endif
    Endif
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Check profit hit


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
joeyp101 @joeyp101 Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/07/2021
Status: Active
Attachments: No files
Logo Logo
Loading...