Hi Guys
Anybody know how best to code an ‘exit for today’ / Exit Trades until Tomorrow please?
I’ve got as far as below, but can’t think how to code the line EXIT MARKET UNTIL TOMORROW
Many Thanks
GraHal
If POSITIONPERF(3) + POSITIONPERF(2) + POSITIONPERF < - x THEN
Sell at Market
Exitshort at Market
EXIT MARKET UNTIL TOMORROW
EndIf
Hi grahal. I’m on the phone txting so it will be short. Try and look at my last post and how I count intradaybarindex perhaps you can reuse some ideas there. IF intradaybarindex>X then exit or somerhing
cheers Kasper
Save the current Date when closing your orders, and test if the current Date is different from this saved variable when you want to launch new orders.
Mmm sounds easy when you say it Nicolas 🙂
I’ve spent some time thinking and trying, but how do I Save the current Date when closing orders please.
Thank You
GraHal
You can do it easily with your previous code:
If POSITIONPERF(3) + POSITIONPERF(2) + POSITIONPERF < - x THEN
Sell at Market
Exitshort at Market
savedate = Date
EndIf
And then when you want to initiate new orders, put a condition to verify if the current Date is not the previously saved one:
if buycondition and Date<>savedate then
BUY 1 SHARE AT MARKET
endif
It may be not the next day (tomorrow as you refer to it), but not the same day as your last closure. Don’t know if it’s important or not.
Embarrasingly easy when watching the Master 🙂 I was over-complicating the Date<>SaveDate.
Results confused me at first. I worked on it (using GRAPH Function) until it made sense. Profit (optimised) almost same as without Date<>Savedate, but profit profile not as good … bigger drawdown.
I’ll run Bot on Demo and if proves good I’ll put on here.
Many Thanks Nicolas
GraHal