Profit optimisation strats based on 1h n htf

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #226138 quote
    ashehzi
    Participant
    Average

    Hi all,

    I understand if running on lower timeframe, we have many ways to close the gains. I am more interested in 1h and higher tfs. 1h means not the code will run only once an hour so I’ve to rely on profit limit orders.

    Options to optimise profits I think of e.g.

    1. prev day high/low
    2. daily atr move
    3. close end of day when RTH finishes.
    4. pivots
    5. vwaps from prev days

    any tested methods more appealing? anything ? Thanks.

    Regards,

    Ash

    #226139 quote
    PeterSt
    Participant
    Master

    Hi Ash,

    1h means not the code will run only once an hour so I’ve to rely on profit limit orders.

    Is this “not” correct in there ? I take it that you meant the “not” not to be in there. Then :

    If the TF of your chart is e.g. 5 minutes, then you can exit each 5 minutes with a Market order (or still a Limit or Stop order). What you would do :

    The code which works with 1h or longer is to be preceded by

    TimeFrame 1 hour

    At the place of the  planned Exits (the code for it) inject a

    TimeFrame(5 minutes, UpdateOnClose)

    Now you’ll have access to the Exit each 5 minutes.

    Is that what you want to achieve ? if not, then possibly that “not” has to be in your sentence after all, and I can’t understand what you mean (yet).
    Of course I understand your suggestions, but they may not be necessary ?

    #226140 quote
    ashehzi
    Participant
    Average

    You can say the lowest timeframe I have is 1h. So I am not going on 30m/15m/5m. I know what you mean, we can do what you’re saying but this is not what I am after. Thanks.

    #226144 quote
    GraHal
    Participant
    Master

    any tested methods more appealing?

    It’s surprising how effective below works … when optmised we get a grand average for X and Y that actually shows good results over the full period.

    Don’t necessarily choose the values giving highest gain (after optimisation).

    If BuyCond Then
    Buy at Market
    Set Stop pLoss X
    Set Target pProfit Y
    Endif
    #226148 quote
    ashehzi
    Participant
    Average

    Thanks <span class=”bbp-author-name”>GraHal</span>. I think I get your point. My code for most of the instrument specific algos is same i.e. define a level with a limit sell/buy order with defined stoploss and target profit.

    There is a trade off if you change stoploss to breakeven (at next run of your code on 1h assuming it is moving in your favour), you may close it for no gain, no risk no reward comes to my mind, always a tricky thing.

    Assuming I shorted NAS at 16591, with target profit of 16551. The problem I face is how to understand that it is a trend day and closing at the end of RTH would be a better option than targeting a defined profit level. Afterall, what makes the difference is how much you made and how much you left on the table.

    #226149 quote
    GraHal
    Participant
    Master

    If after exiting – we think – ‘too early’ (using Set Target pProfit y) and our entry criteria is still valid / still existing then our strategy would open another trade.

    Only costs us a few points spread to enter again.

    If entry criteria is NOT still valid / NOT still existing after exit (as above) then should we even be hanging around in the trade waiting / hoping for more profit?

    If we would not BUY right now, then maybe we should EXIT right now?? 😉

    Just a few general thoughts / ideas.

    #226150 quote
    ashehzi
    Participant
    Average

    I get your point, one can add level to level trading, if closed lower where you e.g. exited your short, then enter again on that level retest down to next lower level like step by step move but sometimes moves are faster and doesn’t allow retesting. If I don’t include retesting and short at market (not limit), then risk factor increases. Incorprating these different options is possible based on the movement e.g. candle (body) size.. but you have to wait for the move to pan out. One option could be to leave target profit empty for 1st hour close (stoploss in place though) so if if the move is faster and better than expected, you can gain more.

    #226153 quote
    GraHal
    Participant
    Master

    leave target profit empty for 1st hour

    If we put Set Target pProfit Y outside the If EndIf Conditions then Y Profit will not be applied until the close of the 1st hour anyway (running on a 1 hour Timeframe).

    Above is an easy way achieve the quoted text.

    #226155 quote
    ashehzi
    Participant
    Average
    BuyCond = a and b and c
    
    If BuyCond Then
    Buy at Market // replace with limit whatever you logic is
    Set Stop pLoss X
    Endif
    
    Set Target pProfit Y

    Isn’t it the whole algo code runs from top to bottom whatever timeframe it runs on? In case of “at market”, it will run straight away while in case of “limit order” it will give you 1 hour as limit order will be placed at barindex while the run of “target pProfit y” will be at barindex+1.

    #226174 quote
    GraHal
    Participant
    Master

    “limit order” it will give you 1 hour as limit order will be placed at barindex

    Below would open a trade just a soon as price is 34000 (No waiting 1 hour etc)

    BuyCond = a and b and c
     
    If BuyCond and Close > 34000 Then
    Buy at 34000 Limit // Market // replace with limit whatever you logic is
    Set Stop pLoss X
    Endif
     
    Set Target pProfit Y

    the run of “target pProfit y” will be at barindex+1.

    Agreed, pProfit y will be set / will appear at the open of the 2nd hour … if the Buy Order has been executed.

    Anybody disagree, feel free to comment?

    #226177 quote
    ashehzi
    Participant
    Average

    Yes, I meant the same. E.g.

    limit order is left at 9am

    9am – 10am it can get executed anytime based on the PA.

    If not executed in that hour, you can re-evaluate to place it again or remove it in your code

    Assuming it did get triggered between 09am and 10am, then at next execution i.e. 10am, you can place a target pprofit or even can wait for x number of bars e.g. if barindex > tradeindex+2

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

Profit optimisation strats based on 1h n htf


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ashehzi @ashehzi Participant
Summary

This topic contains 10 replies,
has 3 voices, and was last updated by ashehzi
2 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/09/2024
Status: Active
Attachments: No files
Logo Logo
Loading...