I have designed the attached EFS file to display a one-bar swing chart loosely based on Gann's 3 day swing charts which will indicate an up or down trend and allow Swing trading.
My problem is that I want to display the information interactively and do not want to use the setComputeOnClose() function.
The following code snippet works perfectly if all you want are color coded bars:-
if (aHigh_G[0] > aHigh_G[1] && aLow_G[0] > aLow_G[1]){
// HIGHER HIGH HIGHER LOW
setPriceBarColor( Color.white );
} else if (aHigh_G[0] < aHigh_G[1] && aLow_G[0] < aLow_G[1]){
// LOWER HIGH LOWER LOW
setPriceBarColor( Color.red );
} else if (aHigh_G[0] < aHigh_G[1] && aLow_G[0] > aLow_G[1]){
// INSIDE DAY
return;
} else if (aHigh_G[0] >= aHigh_G[1] && aLow_G[0] <= aLow_G[1]){
// OUTSIDE DAY
if (aClose_G[0] > aOpen_G[0]){
// OUTSIDE DAY HIGHER CLOSE
setPriceBarColor( Color.white );
}else if (aClose_G[0] < aOpen_G[0]){
setPriceBarColor( Color.red );
} else {
return;
}
} else {
return;
}
However when you add lines to be used as support resistance points as well as text and labels at turning points I have found it impossible for to code to work both interactively on the current bar where changes are updated immediately on each new tick and then update everything properly to all previous bars when a new bar is formed as well as have all the bars properly color coded.
I have tried to use the code snippet above for drawing lines, text and labels and it works well on previous bars but not the current bar as soon as new ticks come in. You have to manually refresh the file to get the correct information display. As per the attached file I split the coding so that the current bar is updated with temporary lines, shapes and text which are removed with each new bar will update interactively on each new tick. I then tried to code separtely for previous bars which fails miserably and I can't understand why.
Any help to make this coding work to the specifications I have outlined would be much appreciated.
Robert
My problem is that I want to display the information interactively and do not want to use the setComputeOnClose() function.
The following code snippet works perfectly if all you want are color coded bars:-
if (aHigh_G[0] > aHigh_G[1] && aLow_G[0] > aLow_G[1]){
// HIGHER HIGH HIGHER LOW
setPriceBarColor( Color.white );
} else if (aHigh_G[0] < aHigh_G[1] && aLow_G[0] < aLow_G[1]){
// LOWER HIGH LOWER LOW
setPriceBarColor( Color.red );
} else if (aHigh_G[0] < aHigh_G[1] && aLow_G[0] > aLow_G[1]){
// INSIDE DAY
return;
} else if (aHigh_G[0] >= aHigh_G[1] && aLow_G[0] <= aLow_G[1]){
// OUTSIDE DAY
if (aClose_G[0] > aOpen_G[0]){
// OUTSIDE DAY HIGHER CLOSE
setPriceBarColor( Color.white );
}else if (aClose_G[0] < aOpen_G[0]){
setPriceBarColor( Color.red );
} else {
return;
}
} else {
return;
}
However when you add lines to be used as support resistance points as well as text and labels at turning points I have found it impossible for to code to work both interactively on the current bar where changes are updated immediately on each new tick and then update everything properly to all previous bars when a new bar is formed as well as have all the bars properly color coded.
I have tried to use the code snippet above for drawing lines, text and labels and it works well on previous bars but not the current bar as soon as new ticks come in. You have to manually refresh the file to get the correct information display. As per the attached file I split the coding so that the current bar is updated with temporary lines, shapes and text which are removed with each new bar will update interactively on each new tick. I then tried to code separtely for previous bars which fails miserably and I can't understand why.
Any help to make this coding work to the specifications I have outlined would be much appreciated.
Robert
Comment