SellShort not being triggered

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

    Hello, I’m testing a simple backtest, below is an outline of what it should do

    1. Adjust the level at which a Short is triggered if a higher low for the previous candle occurs.
    2. The level of the Short is set to the value of the new higher low minus 10pips

    For some reason it never triggers, if I set an explicit vale like, 1.48020 then it’ll work fine, attached is a screenshot of my backtest with indicators as to where it starts and where I expect the trigger to occur. Any help or suggestions would be greatly appreciated.

    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    ONCE levelUpdated = 0
    ONCE trackPips = 0.00100
    ONCE shortPrice = 0
    
    IF (Low[1]-trackPips) > shortPrice THEN
    shortPrice = (Low[1]-trackPips)
    levelUpdated = 1
    ENDIF
    
    IF STRATEGYPROFIT > 0 OR STRATEGYPROFIT < 0 THEN
    QUIT
    ENDIF
    
    IF levelUpdated = 1 THEN
    SELLSHORT 1 CONTRACT AT shortPrice STOP
    levelUpdated = 0
    ENDIF
    short-strategy.png short-strategy.png
    #82037 quote
    GraHal
    Participant
    Master

    I reckon the problem is to do with the trackPips, but I can’t explain why (without thinking how to explain, maybe more later)! 🙂

    Also your code doesn’t mention highest low (or can’t I see it?) but your image states that Sellshort should have executed at 10 points below highest low?

    #82048 quote
    Nicolas
    Keymaster
    Master
    GRAPH ShortPrice

    while backtesting will surely gives you useful info to spot where the trouble is!

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

SellShort not being triggered


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by Nicolas
7 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/05/2018
Status: Active
Attachments: 1 files
Logo Logo
Loading...