Entry on today's close price and exit tomorrow

I am kinda lost after trying for hours.

my condition is simple - buy on today's close, exit tomorrow if price goes above say 0.5% above yesterday's close or exit even if the price doesn't reach that price level, no holding beyond tomorrow
my problem is how to exit even if the price doesn't hit the target price, may be at a loss

I ahve coded like this, please help

Buy = 1; 

Sell = 0;                        
    
SetPositionSize(20000, spsValue); 

ApplyStop(stopTypeProfit,stopModePercent,Optimize("Max Stop Percent",Param("Max Stop Percent",0.5,0.1,20,0.1),0.1,20,0.1),1);

I am simply helpless now
What happens is that when the target is not hit, it holds for many many bars till that price is met, which I don't want.

You can use multiple ApplyStop()

Make sure they are of different type

ApplyStop( stopTypeProfit, ... 
ApplyStop( stopTypeNBar, ... 

And I suggest: don't look at tomorrow as "tomorrow", as in the future.
Instead refer to exit as Bars Since entry, this will be in the present.
So it would sound better, if you entered yesterday based on some condition(s) and exited today based on some condition(s).

2 Likes

Intraday Timeframe(1min) or Daily TimeFrame ?

1 Like

Thanks for the replies, don't bother now, I have done some work on it and tested, the results are very disappointing.
Sorry to waste your time.

Daily time frame

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.