Algo Trading using Open=High Open=Low Strategy
OHOL Strategy
In this episode, we will be
scripting a Strategy for intraday traders to trade using a
simple OHOL. This strategy is back-testable.
So, let’s begin with the rules….
Rules
Buy :
We need to buy, If low price of the stock is equal to it’s open price, as this
indicates buying pressure.
Short :
We need to short, If high price of the stock is equal to it’s open price, as
this indicates selling pressure.
Simple., isn’t it?
Let’s jump to the script part
directly now
First, we are directly generating the buy and sell signal,
Buy :
We need to buy, If low price of the stock is equal to it’s open price, as this
indicates buying pressure.
Short :
We need to short, If high price of the stock is equal to it’s open price, as
this indicates selling pressure.
Buy = Open == Low;
Sell = Open == High;
This is for trading signal
generation, now let’s code for exploration.
Get the open, high and low
price of the day and look for open-high and open-low and assign red and green
color respectively and show the data using add columns.
_SECTION_BEGIN(“Open == High AND Open == Low
Exploration”);
DOpen = TimeFrameGetPrice( “O”, inDaily, 0 ); // gives
you Todays Open price.
DHigh = TimeFrameGetPrice( “H”, inDaily, 0 ); // gives
you Todays High price.
DLow = TimeFrameGetPrice( “L”, inDaily, 0 ); // gives
you Todays High price.
newday = Day() !=
Ref(Day(),-1); //check for the start of the day
opencond = newday AND (DOpen == DHigh OR DOpen == DLow);
Filter = opencond ;
colorstatus = IIf(newday AND DOpen == DHigh,colorRed,IIf(newday
AND DOpen == DLow,colorGreen,Null));
AddColumn(IIf(newday AND DOpen ==
DHigh,DHigh,Null),”Open==High”,1.2,colorWhite,colorstatus);
AddColumn(IIf(newday AND
DOpen == DLow,DLow,Null),”Open == Low”,1.2,colorWhite,colorstatus);
So go to explore window to
look at the details
And lastly let’s move to backtesting. We can run backtest of this
strategy in Daily TF to check the results (25% with 6% drawdown)
Check Out Script Library to get script used for this episode:
https://marketsecrets.in/script-library/
To know more, checkout:
Related
Algo Trading using Open=High Open=Low Strategy amibroker tutorial videos Getting started with algo-trading basics how to backtest a trading strategy? how to learn algo trading? how to start with algo trading in india? how to use amibroker afl for algo trading? how to use pine script for algo trading? how to write algo trading scripts? Pine script tutorial videos step-by-step approach to start with algo-trading in India