Refuse same entry

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #190293 quote
    deleted23092025
    Participant
    New

    Hi folks!

    I am trying to fit this filter into my code, but can not really figure out how to write it in code.

    Lets say for example I trade Nasdaq and entry long @ 14216 and it runs to stoploss. Next hour or within 3 days it’s back to 14216 and it takes long again (I want to prevent this) as it is probably in a range (and high chance to run to stoploss again).

     

    If //latest short position lost with entry @ 34 382 Then
    //don’t trade short with the interval 0.1% from @34 382 for the next 3 days

    endif

    if
    //latest long position lost with entry @ 34 382 Then
    //don’t trade long with the interval 0.1% from @34 382 for the next 3 days
    EndIf

    #190320 quote
    robertogozzi
    Moderator
    Master

    Not tested:

    ONCE UpperLimit = 0
    ONCE LowerLimit = 0
    ONCE PerCent    = 0.1
    IF OnMarket AND Not OnMarket[1] THEN
       MyPC       = (TradePrice * PerCent / 100)
       UpperLimit = TradePrice + MyPC
       LowerLimit = TradePrice - MyPC
    ENDIF
    IF StrategyProfit > StrategyProfit[1] THEN
       UpperLimit = 0
       LowerLimit = 0
    ENDIF
    EntryCondition = (((close >= UpperLimit) OR (close <= LowerLimit)) AND (UpperLimit <> LowerLimit)) OR (UpperLimit = LowerLimit)
    IF MyLongConditions AND EntryCondition THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF
    IF MyShortConditions AND EntryCondition THEN
       SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    #191865 quote
    deleted23092025
    Participant
    New

    Thank you so much Roberto!

    After some thinking what the problem usually is.. The problem often is trendfollowing algos which get in some consonlidation phase. I attached picture to explain it, in the brown box the algo starts long position and in the red box the algo think the trend is short and start short position. But when you zoom out a bit on 1 hour timeframe (this is on DAX) it is pretty simple to see it is in a range.

    Does anyone have some ideas how you could prevent lower TF trending algorithms to not in this example enter long in brown zone and short in red zone on 1h timeframe.

    All ideas are welcome!

    13b5840052fe52caffc5797f2982cd3e.png 13b5840052fe52caffc5797f2982cd3e.png
    #191867 quote
    robertogozzi
    Moderator
    Master

    Using MTF (Multiple Time Frames) may help you better detect such periods. There will never be an accurate way to avoid those traps, but for sure higher TFs grant better signals.

    If you have never used MTF, you can search that word to be reported many useful links to instructions, blogs, articles and many examples on that subject.

    #191870 quote
    deleted23092025
    Participant
    New

    I know MTF will be the perfect fit for this. I know how to use MTF, I just  wanted to know if someone had some good ideas in terms of code for not trading in ranges like this.

    #191907 quote
    robertogozzi
    Moderator
    Master
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Refuse same entry


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/21/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...