Hi. I want to trade the major indices with the following condition. Assume c1 is the condition for a long trade. If c1, then enter a long trade if a following bar crosses over the high of the signal bar. The entry level should be the high of the signal bar (not the next market open). The order should be valid for x bars after the signal bar. The profit limit is the close of the signal bar plus the ATR and the stop loss is the close of the signal bar minus the ATR.
Hi Paulon, as a start, check out this link :
Customized Oscillator that take initial value the yesterday's highest/top price
More experienced coder might jump in this tread soon 😉
Thx
Yes. Just use:
BUY ? Contracts AT High STOP
SELL AT (close + AverageTrueRange[?]) LIMIT
SELL AT (close - AverageTrueRange[?]) STOP
Obviously replace the ? with your values. You will have to set these instructions at the close of every bar that you want the instruction to last for as they only last for one bar and are then cancelled.
Hi. I want to trade the major indices with the following condition. Assume c1 is the condition for a long trade. If c1, then enter a long trade if a following bar crosses over the high of the signal bar. The entry level should be the high of the signal bar (not the next market open). The order should be valid for x bars after the signal bar. The profit limit is the close of the signal bar plus the ATR and the stop loss is the close of the signal bar minus the ATR.
By no means you (and anyone else) may access future data. So you’ll have to modify your sentence to the past: “Assume c1[1] is the condition for a long trade, then enter a long trade if THIS bar crosses over the high of the signal (previous) bar. i.e. HIGH[1]”.
Thank you for sharing this idea.
I see good results on the DAX 4h (with some adjustments of course).
Please could you share @mr blue?
I did have a play with the concept, but couldn’t get much out of it.
I picked up the original idea, looked for a profitable timeframe on the DAX and added one additional condition, that the market must be “risk on” – otherwise it will not buy.
defparam cumulateorders = false
Ht = DHigh(1)
Bs = DLow(1)
C = DClose(1)
Pivot = (Ht + Bs + C) / 3
//Res4 = Pivot + ((Ht - Bs)*3)
//Res3 = Pivot + ((Ht - Bs)*2)
//Res2 = Pivot + Ht - Bs
Res1 = (2 * Pivot) - Bs
//Sup1 = (2 * Pivot) - Ht
//Sup2 = Pivot - (Ht - Bs)
//Sup3 = Pivot - ((Ht - Bs)*2)
//Sup4 = Pivot - ((Ht - Bs)*3)
if close > Res1 then
BUY 1 Contracts AT High STOP
SELL AT (close + AverageTrueRange[9]) LIMIT
SELL AT (close - AverageTrueRange[9]) STOP
endif
Using this source version you get the following results backtested (profit chart RED) … of course I investigated a bit more in this approach and the current result of the – not yet shared code – is the GREEN profit chart. Trading with fix 1 lot on the 1 EURO DAX CFD. Using a re-invest rule the profit rocks up > 25K in the same period of time.
I would be thrilled to see your version of the code beating the results of the RED and GREEN version. Let’s do a little competition here 🙂
PS: The green one will be shared later …
I have 27379 EUR… 10.000 bars (starting from October 1st 2013)
Signal taken from the post #59336
Code will be shared later 😉 I would be happy to see so other tentatives once I’ll be back from the soccer field … 😉
EricParticipant
Master
IF IntradayBarIndex = 1 THEN
Hi = HIGHEST[1](HIGH)
ENDIF
RETURN Hi
I have 27379 EUR… 10.000 bars (starting from October 1st 2013) Signal taken from the post #59336 Code will be shared later
I would be happy to see so other tentatives once I’ll be back from the soccer field … 
Thanks for posting your results. How does the result look like with only 1 LOT ?
Yes Mr Blue, let’s keep 1 lot only. I am working on 2016…
Ok. Below my last tentative…
Well done Inertia! Any chance to mitimize the drag down early 2016?
Thx Mr Blue. All I know comes from this forum ;).
Attached is the same strategy on 200.000 bars..
Thanks for posting your results. How does the result look like with only 1 LOT ?
Not much better than buy and hold, I fear…
It works because there is a bull market. You could as well buy every day, or once a week, or once a month.
Buying at intermediate lows instead would increase performance somewhat, I think.