I would like to execute the code set out at the end and which is summarized below
if (high(0) < high(-1)) {FlagB = high(“-count”)}
// ie high(-1) high(-2) high(-3) etc
until count ends
if (high(0) < high(-1)) {start “count”}
if (high(0) > high(-1)) {end “count”}
then start the process again
However I cant seem to link the count into the above -
I have set out what I have done below
could someone set out where I am going wrong
The message I get is
"Undefined function call"
this refers to the very last line where I try to use the counter as a reference for which high(-x) to use in plotting the output
Thanks
function preMain() {
setPriceStudy(true);
setPlotType(PS_DASH,0);
setCursorLabelName("FlagB", 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(3, 0);
var fp1 = new FunctionParameter("counter", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(1);
var FlagB = null;
var counter = null;
function main(counter) {
if(high(0)<high(-1)) {counter=1}
if(high(0)>high(-1)) {counter=0}
if(high(0)<high(-1)) {FlagB = -counter}
//debugClear();
//debugPrintln('done');
//debugPrintln('counter is ' +counter);
for (var counter = (counter); counter < 100; counter++){
if (counter == 100){
break}
if (counter == -100){
break}
}
return(FlagB(-"counter"));
}}
if (high(0) < high(-1)) {FlagB = high(“-count”)}
// ie high(-1) high(-2) high(-3) etc
until count ends
if (high(0) < high(-1)) {start “count”}
if (high(0) > high(-1)) {end “count”}
then start the process again
However I cant seem to link the count into the above -
I have set out what I have done below
could someone set out where I am going wrong
The message I get is
"Undefined function call"
this refers to the very last line where I try to use the counter as a reference for which high(-x) to use in plotting the output
Thanks
function preMain() {
setPriceStudy(true);
setPlotType(PS_DASH,0);
setCursorLabelName("FlagB", 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(3, 0);
var fp1 = new FunctionParameter("counter", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(1);
var FlagB = null;
var counter = null;
function main(counter) {
if(high(0)<high(-1)) {counter=1}
if(high(0)>high(-1)) {counter=0}
if(high(0)<high(-1)) {FlagB = -counter}
//debugClear();
//debugPrintln('done');
//debugPrintln('counter is ' +counter);
for (var counter = (counter); counter < 100; counter++){
if (counter == 100){
break}
if (counter == -100){
break}
}
return(FlagB(-"counter"));
}}
Comment