This strategy is very simple. But the results are not bad at all. This strategy only works on higher time frames.
1 hour - 2 hour - ....even day chart.
Like the title says it just follows the "flow". Now what does the strategy mean with "flow". The strategy wait until their is a candle with a body bigger then the average true range + an adjustable offset.
In plain simple words :
If it sees a big red candle.....it goes short
if it sees a big green candle....it goes long
How simple can it get anyway?
When does the strategy take profit.
fpl() > Average_True_Range.line[currentbar]*10000*lots
This means it tries to take profit in function of the average true range. If their is high volatility it tries to benifit by taking larger profits... I am sure you like that no?
Maximum loss is protecting the positon:
if fpl() < -maxloss*lots then
Most of you will wonder what the use is of the following lines.
if close[currentbar]>open[currentbar] and ((close[currentbar]-open[currentbar])>(Average_True_Range.line[currentbar])) and short() then exitshort();
if close[currentbar]<open[currentbar] and ((open[currentbar]-close[currentbar])>(Average_True_Range.line[currentbar])) and long() then exitlong();
That all part of the strategy. If we consider a big green body as a signal for buying why should we not consider a big red than as a signal that long wasn't maybe not a good idea at all. So we better close are position.
Now the code:
The code for traders using the older versions of dealbook or prostation:
strategy go_with_the_flow;
/*written by ctlprogrammer*/
/*Warning for demonstration purpose only, no live trading please*/
/*you can freely copy the code but plz leave this header*/
/*http://ctltrading.blogspot.com*/
input lots = 1,maxloss=40,offset=0.003;
vars currentbar(number);
begin
if back(close) < front(close) + 14 then return;
currentbar := back(close);
Average_True_Range();
/*entry*/
if close[currentbar]>open[currentbar] and ((close[currentbar]-open[currentbar])>(Average_True_Range.line[currentbar]+offset)) and not long() then buy(lots);
if close[currentbar]<open[currentbar] and ((open[currentbar]-close[currentbar])>(Average_True_Range.line[currentbar]+offset)) and not short() then sell(lots);
/*exit*/
if close[currentbar]>open[currentbar] and ((close[currentbar]-open[currentbar])>(Average_True_Range.line[currentbar])) and short() then exitshort();
if close[currentbar]<open[currentbar] and ((open[currentbar]-close[currentbar])>(Average_True_Range.line[currentbar])) and long() then exitlong();
if fpl() > Average_True_Range.line[currentbar]*10000*lots then
begin
if long() then exitlong();
if short() then exitshort();
end;
if fpl() < -maxloss*lots then
begin
if long() then exitlong();
if short() then exitshort();
end;
The code for traders that are using a new version of dealbook or prostation:
strategy go_with_the_flow;
/*written by ctlprogrammer*/
/*Warning for demonstration purpose only, no live trading please*/
/*you can freely copy the code but plz leave this header*/
/*http://ctltrading.blogspot.com*/
input lots = 1,maxloss=40,offset=0.003;
begin
integer currentbar;
if back(close) < front(close) + 14 then return;
currentbar := back(close);
Average_True_Range();
/*entry*/
if close[currentbar]>open[currentbar] and ((close[currentbar]-open[currentbar])>(Average_True_Range.line[currentbar]+offset)) and not long() then buy(lots);
if close[currentbar]<open[currentbar] and ((open[currentbar]-close[currentbar])>(Average_True_Range.line[currentbar]+offset)) and not short() then sell(lots);
/*exit*/
if close[currentbar]>open[currentbar] and ((close[currentbar]-open[currentbar])>(Average_True_Range.line[currentbar])) and short() then exitshort();
if close[currentbar]<open[currentbar] and ((open[currentbar]-close[currentbar])>(Average_True_Range.line[currentbar])) and long() then exitlong();
if fpl() > Average_True_Range.line[currentbar]*10000*lots then
begin
if long() then exitlong();
if short() then exitshort();
end;
if fpl() < -maxloss*lots then
begin
if long() then exitlong();
if short() then exitshort();
end;
end.
No comments:
Post a Comment