Hi, I want to set up automated trading, but I only want to do this with a strategy that is working daily from 7.45 AM untill 18.00 PM. Is this possible to set up? Thanks in advance.
Yes it is!
IF TIME>=074500 AND TIME<180000 THEN
Trading=1
ELSE
Trading=0
ENDIF
Just add “if trading=1” to your condition to enter market
cheers
There is another way to even exit at market if end time reach.
DEFPARAM FLATBEFORE = 074500
DEFPARAM FLATAFTER = 180000
Advise: those lines must be at first lines before code
I’ve never tried, but is there a way to Conditionalise DEFPARAM FLATAFTER so that if a position in profit is open, it won’t close ?
Yes I need this too Grizzly, but something like the opposite …
If position is at Loss < – L then don’t close until time T or Loss > 0
Logic being that without above condition you may be closing near the bottom of a short term cycle / wave which may recover somewhat in 1 or 2 hours.
Thanks
GraHal
@grizzly and @GraHal
With POSITIONPERF you can easily test if the actual positions are in profit. If so, make a conditional statement to close the basket or not accordingly to the present time.
Hi Nicolas, thanks
Yes I use Positionperf a lot, it is very very useful.
2 days ago one of my positions closed under a FlatAfter rule with a near £2,500 loss (it was only Demo!) I checked after and it would have recovered a few hours later.
So it was the above that prompted my question after Grizzly asking also.
Its just that I have started using Strategies in French etc and so tweaking existing code (to add Positionperf) is not straightforward (I am english only), but I’ll get there with the help of google translate and learn French also! ha
Cheers
GraHal