Comment on Code your Technical Analysis strategy

Nithin Kamath commented on 26 Apr 2013, 10:04 AM

This one is actually pretty simple if I got your query right.

The idea is to buy if the price goes higher than high of the previous candle and sell if it goes lower than the previous low.

Good thing with this is that again you are going with the nearest trend. If you are using 1 minute candles there might be a lot of buy and sell signals, ensure you choose the right candle for a strategy like this.

The code:

Buy expression: CLOSE>REF(HIGH,1) Sell Expression: CLOSE<REF(LOW,1)
Buy exit : 0 Sell exit: 0

A REF function basically takes you to any previous candle, in this case(High,1) will give you a reference of highest 1 candle back(previous candle).

If you mentioned REF(High,3), it will take reference of the highest point 3 candles back.

Similarly for the Sell, REF(LOW,1) will give you a reference point of low of 1 candle back. So if the present candle closes below the previous candle low,you automatically get an indicator.

exit expression is kept at 0 , because you want to exit and also reverse the trade if the opposite indicator initiates. So if you have bought 1 lot, when the sell indicator comes, you exit your 1 lot and take a fresh short of 1 lot.

Hope this clarifies.

View the full comment thread »