startIndex= SelectedValue(BarIndex());
endIndex = EndValue( BarIndex() );
if (startIndex != endIndex) {
highestHigh = 0.0;
lowestLow = 0.0;
ps1 = 0.0;
pa1 = 0.0;
reCalcSignal = True;
reCalcTime = 0;
highestHighReCalcSignal = True;
lowestLowReCalcSignal = True;
}
for (i = startIndex; i < endIndex + 1; i++ ) {
todayHigh_history_tmp = High;
todayLow_history_tmp = Low;
today_history_PreClose =Close;
if ( reCalcSignal AND TimeNum() > reCalcTime) {
if (highestHighReCalcSignal) {
lowestLow=99999999;
if (lowestLowReCalcSignal) {
highestHigh = -99999999;
}
highestHighReCalcSignal = False;
lowestLowReCalcSignal = False;
reCalcSignal = False;
}
if (todayHigh_history_tmp >= highestHigh) {
highestHigh = todayHigh_history_tmp;
highest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
ps1= highestHigh+highest_csbdl*0.236;
}
if (todayLow_history_tmp <= lowestLow) {
lowestLow = todayLow_history_tmp;
lowest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
pa1 = lowestLow+lowest_csbdl*0.236;
}
if ((todayLow_history_tmp < pa1) OR (todayHigh_history_tmp > ps1)) {
reCalcSignal = True;
reCalcTime = TimeNum();
if (todayHigh_history_tmp >ps1) {
highestHighReCalcSignal = True;
highestHigh = todayHigh_history_tmp;
highest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
ps1= highestHigh+ highest_csbdl*0.236;
}
if (todayLow_history_tmp <pa1) {
lowestLowReCalcSignal = True;
lowestLow = todayLow_history_tmp;
lowest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
pa1 = lowestLow+lowest_csbdl*0.236;
}
}
output1 = ps1;
output2 = pa1;
}
Plot( output1 , "",22,styleNoLine );
Plot( output2 , "",22,styleNoLine );
endIndex = EndValue( BarIndex() );
if (startIndex != endIndex) {
highestHigh = 0.0;
lowestLow = 0.0;
ps1 = 0.0;
pa1 = 0.0;
reCalcSignal = True;
reCalcTime = 0;
highestHighReCalcSignal = True;
lowestLowReCalcSignal = True;
}
for (i = startIndex; i < endIndex + 1; i++ ) {
todayHigh_history_tmp = High;
todayLow_history_tmp = Low;
today_history_PreClose =Close;
if ( reCalcSignal AND TimeNum() > reCalcTime) {
if (highestHighReCalcSignal) {
lowestLow=99999999;
if (lowestLowReCalcSignal) {
highestHigh = -99999999;
}
highestHighReCalcSignal = False;
lowestLowReCalcSignal = False;
reCalcSignal = False;
}
if (todayHigh_history_tmp >= highestHigh) {
highestHigh = todayHigh_history_tmp;
highest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
ps1= highestHigh+highest_csbdl*0.236;
}
if (todayLow_history_tmp <= lowestLow) {
lowestLow = todayLow_history_tmp;
lowest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
pa1 = lowestLow+lowest_csbdl*0.236;
}
if ((todayLow_history_tmp < pa1) OR (todayHigh_history_tmp > ps1)) {
reCalcSignal = True;
reCalcTime = TimeNum();
if (todayHigh_history_tmp >ps1) {
highestHighReCalcSignal = True;
highestHigh = todayHigh_history_tmp;
highest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
ps1= highestHigh+ highest_csbdl*0.236;
}
if (todayLow_history_tmp <pa1) {
lowestLowReCalcSignal = True;
lowestLow = todayLow_history_tmp;
lowest_csbdl = (highestHigh +todayLow_history_tmp+today_history_PreClose)/3;
pa1 = lowestLow+lowest_csbdl*0.236;
}
}
output1 = ps1;
output2 = pa1;
}
Plot( output1 , "",22,styleNoLine );
Plot( output2 , "",22,styleNoLine );