LOParticipant
Junior
Hi,
I’m stuck and could use a little help.
I would like to add orders based on price of last order + ATR, I think I got that right. But I would also like the Stop Loss to follow along, that’s to big challange for me. Anyone want to help?
Example.
Price 100
ATR 10
Order 1: 1 contract @ 100, stop @ 90
Order 2: 1 contract @ 110. stop @ 100 and stop for order 1 should also move to 100
Order 3: 1 contract @ 120, Stop @ 110 and stop for both order 1 and 2 should move to 110
Order 4: 1 contract @ 130, stop @ 120 and stop for order 1-3 should move to 120.
Maximum orders at any give time is 4 and the last stop should not move from 120. Exit is @ Low [n] not a stop loss.
If let’s say price move to 115 and down to 75, order 1-2 should execute and then stop out @ 100 with 10 loss.
Let’s say price move to 200 and then down to 110, and Exit (Low [10]) is 180, all the orders should exit @ 180 with entry @ 100-110-120-130 and profit 260.
It’s alot like the moneymanagementsystem as turtle traders used back in the day….at least according to one of the books.
This shouldn’t be problem. To you mind sharing your code you have so far so I can add the stops and so on.
>> Hi, Please update your country flag by selecting a location in your profile settings. Thank you 🙂 <<
LOParticipant
Junior
Thanks, here’s the code so far:
I’m looking for a modified version of turtle trading strategy, most for fun and see if it works nowadays. Read the book couple of weeks ago, great story by the way. 🙂
Adding 1/4 ATR to each position and move the stop accordingly, the first example was for ilustration only.
DEFPARAM CUMULATEORDERS = true
a = highest[55](high)
b = lowest[20](low)
c = Average[50](close)
d = Average[200](close)
Avg = 0.25*AverageTrueRange[14](close)
// Long Entry
Long = HIGH>a[1] AND c > d
// Long Exit
LongExit = LOW<b[1]
if countofposition<=4 then
IF NOT LongOnMarket AND Long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
IF High>TradePrice(1)+avg THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
ENDIF
SET STOP LOSS 2*AverageTrueRange[14](close)
If LongOnMarket AND Longexit THEN
SELL AT MARKET
ENDIF
Ok and where do you want to have the SL? Always 2*ATR away from the combined positionprice? This would look like this:
if longonmarket then
sell at positionprice-2*averagetruerange[14](close) stop
endif
LOParticipant
Junior
Ok, what do you mean with combined price? I assume you mean 2*atr from last position taken, is that the same perhaps?
LOParticipant
Junior
Or to be more precise, it’s 2*atr from last position entry price.
So you do not want the SL to be in the distance from the combined price (your average position price changes when you cumulate) but from the last lot you bought? In that case just replace positionprice with tradeprice.