Has anyone had much luck with coding chart patterns.
I want to code a simple double bottom with lower volume
So the pseudo code would be something like
If double bottom and volume on current bar is < than what is was previous time down here
- then buy
But i don't know how i can find double bottoms, or any swings?
How to code double bottom?
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: How to code double bottom?
Has anyone had much luck with coding chart patterns.
I want to code a simple double bottom with lower volume
So the pseudo code would be something like
If double bottom and volume on current bar is < than what is was previous time down here
- then buy
But i don't know how i can find double bottoms, or any swings?
I believe this study was coded by Suri Dudella.
Just found it by Google it.
See if suits you.
Code: Select all
Input: Lookback(50),Strength(5);
Var: LastHighPivotbar (0),LastLowPivotbar (0),PreviousHighPivotbar (0),PreviousLowPivotbar(0),
LastHighPivot (0),LastLowPivot (0),PreviousHighPivot (0),PreviousLowPivot(0),DT (False),DB (False);
LastHighPivotBar = PivotHighVSBar(1,H,Strength,Strength,Lookback);
LastLowPivotBar = PivotLowVSbar(1,L,Strength,Strength,Lookback);
PreviousHighPivotBar = PivotHighVSBar(2,H,Strength,Strength,Lookback);
PreviousLowPivotBar = PivotLowVSbar(2,L,Strength,Strength,Lookback);
LastHighPivot = PivotHighVS(1,H,Strength,Strength,Lookback);
LastLowPivot = PivotLowVS(1,L,Strength,Strength,Lookback);
PreviousHighPivot = PivotHighVS(2,H,Strength,Strength,Lookback);
PreviousLowPivot = PivotLowVS(2,L,Strength,Strength,Lookback);
/////////////////////////////DT/////////////////////
If LastHighPivot <> - 1 and LastLowPivot <> -1 and PreviousHighPivot <>-1 and PreviousLowPivot <> -1
and PreviousHighPivot < PreviousLowPivotBar + averagetruerange(10)
and PreviousHighPivot > LastHighPivot - averagetruerange(10)
and LastHighPivot > LastLowPivot + 3* averagetruerange(10)
and LastLowPivotbar > LastHighPivotbar
then begin
DT = TRUE;
end
else begin
DT = False;
end;
If DT = True then begin
Plot1 [PreviousHighPivotBar ](PreviousHighPivot ,"DT1",Blue);
Plot2 [LastHighPivotBar ](LastHighPivot ,"DT2",Blue);
end;
/////////////////////////////DB/////////////////////
If LastHighPivot <> - 1 and LastLowPivot <> -1 and PreviousHighPivot <>-1 and PreviousLowPivot <> -1
and LastLowPivot < PreviousLowPivot + averagetruerange(10)
and LastLowPivot > PreviousLowPivot - averagetruerange(10)
and LastHighPivot > LastLowPivot + 3* averagetruerange(10)
and LastHighPivotbar > LastLowPivotBar
then begin
DB = TRUE;
end
else begin
DB = False;
end;
If DB = True then begin
Plot3 [PreviousLowPivotBar ](PreviousLowPivot ,"DB1",Yellow);
Plot4 [LastLowPivotBar ](LastLowPivot,"DB2",Yellow);
end;