A question regardless of the time frame. As you can see in the picture, my entrances are relatively clear. But that has never been my problem either. My problem is how do I define / code the goal, the takeprofit. Highlighted in color on the picture. In this case it is the final low. Does anyone have an idea how I could code that?
ArrayMin ?
https://www.prorealcode.com/documentation/arraymin/
Or maybe we can’t define Lowest Low until we have a Higher Low?
Looking at the Chart, how about FastAverage[Period,Type](close) > SlowAverage[Period,Type](close)
Good Topic! 🙂
Or simply getting out of the backcross MACDHISTO? In the picture the end of the movement. 🤔 Unfortunately, I have no idea about arrays. 😁
I’ve been doing this all day, manually mind you. With different assets. Wave diver SMA20 / 200 with filter in the M1 works as a mechanical variant. At least today. As I said, I only work from my cell phone at the moment. MACD pullback works very well as well. I’m just looking for a way to get out of the car. An indicator that shows me this or a calculation for the TP.
Did you see the Topic below … MAE using Arrays!
I might even have a go myself, something new to revitalise interest! 🙂
https://www.prorealcode.com/topic/mae-maximisation/
Ha, I fell at the first hurdle … as the code is written, it won’t give us the turning point. Code on the link above is for the MAE after several Orders. But I’m sure a man of your coding calibre can adapt it phoentzs ? 🙂
Haha I’ve got it doing ‘something’ … there is no exit in the code apart from using Array values!
Need to do some jobs now, but more later hopefully!
you should be able to use the inverse of a Donchian stop
// DONCHIAN STOP
Upper = Highest[D](high)
Lower = Lowest[D](low)
if longonmarket then
laststop = Lower[1]
endif
if shortonmarket then
laststop = Upper[1]
endif
if onmarket then
sell at laststop stop
exitshort at laststop stop
endif
not tested but I think it would be:
// DONCHIAN EXIT
Upper = Highest[D](high)
Lower = Lowest[D](low)
if longonmarket then
takeprofit = Upper[1]
endif
if shortonmarket then
takeprofit = Lower[1]
endif
if onmarket and positionperf >0 then
sell at takeprofit limit
exitshort at takeprofit limit
endif
optimize D for how far back you want it to look for the last dip / peak
@ Grahal Thanks for your approach. Maybe you could post your version of the code? I still don’t really get it. 🙈 I had already worked through the subject of arrays. Unfortunately, since I’m not a big coder, I still haven’t understood how it works.
@nonetheless Thanks for the suggestion. I understand this solution. 😁 I could try that.
JSParticipant
Senior
Nice idea nonetheless
But I think it will take profit the moment you enter.
The price is already above the previous Upper (when Long).
I would also try different values for D upper and D lower, ie DL and DS, as falling price patterns can be very different than rising.
But I think it will take profit the moment you enter.
not if D = 200 (for example)
Here on the M1 Nasdaq last night. Long entrances green vertical marking and exits in red. The system is the wave diver, works only with the SMAs. But gets out very precisely near the summit.
you could also just use a fast MA with very little lag, like Least Squares or Time Series