Hi,
I wrote a simple code which determine the Breakout Inside Day (BID) setup...
Here is my code:
See example 1
My question is how would I change the code so that:
1. The ID setup bars painted as well (better a different color)
2. The code to mark any bar that the BID occur (not only the next bar) what meet the conditions.
See example 2
I would appreciate any tips!
Best wishes,
I wrote a simple code which determine the Breakout Inside Day (BID) setup...
Here is my code:
PHP Code:
var lastrawtime = 0;
var BarCount = 0;
function preMain() {
setPriceStudy(true);
setStudyTitle("Breakout_ID");
setShowCursorLabel(false);
setDefaultPriceBarColor( Color.black );
//setComputeOnClose();
}
function main() {
if (lastrawtime != getValue("rawtime", 0)) {
BarCount += 1;
lastrawtime = getValue("rawtime", 0);
}
if (high(-2) > high(-1) && low(-2) < low(-1) && low(0) < low(-2)){
setPriceBarColor(Color.red);
Alert.addToList(getSymbol(), "BID Short", Color.black, Color.red);
nLastRawTime = getValue("rawtime",0);
}else{
removeText("Dn"+BarCount);
}
if (high(-2) > high(-1) && low(-2) < low(-1) && high(0) > high(-2)){
setPriceBarColor(Color.blue);
Alert.addToList(getSymbol(), "BID Long", Color.black, Color.blue);
nLastRawTime = getValue("rawtime",0);
}else{
removeText("UP"+BarCount);
}
return null;
}
My question is how would I change the code so that:
1. The ID setup bars painted as well (better a different color)
2. The code to mark any bar that the BID occur (not only the next bar) what meet the conditions.
See example 2
I would appreciate any tips!
Best wishes,
Comment