Workshop - Branches and Loops

Posted By: EvidenceBasedFx

Workshop - Branches and Loops - 10/27/19 02:08

from https://manual.zorro-project.com/tutorial_var.htm
Quote
When you click [Test] to run that script, you'll notice that the bottom slider gets the label "Profit".


I ran the code as shown but do not see a label for slider 3. Also, the slider amount looks like it should be limited to the range 50 0-200? However my slider starts at 200 and goes to 29166569.

Is this unexpected? Should I just relax and ignore these quirks? I'm using v. 2.15

Update: Yes I made a mistake with my range expectation - it should be possible to to go down to zero but in fact I cannot do this - see my next post.
Posted By: AndrewAMD

Re: Workshop - Branches and Loops - 10/27/19 11:08

Code
function main()
{
  var profit = slider(3,50,0,200,"Profit",0);
  if(profit > 100)
    printf("Enough!");
  else
    printf("Not enough!");
}
The above code sample works for me.

Also, you are expecting the wrong range. Please read the description of slider() here:
https://manual.zorro-project.com/slider.htm
Posted By: EvidenceBasedFx

Re: Workshop - Branches and Loops - 10/27/19 20:47

Thanks Andrew - when you say it works do you see the slider label named 'profit'? I should mention that the script basically 'works' apart from the quirks of missing label and profit slider with unexpected values behaviour (more detail below).

The documentation seems to confirm that I am expecting the correct range.

Parameters are 3,50,0,200,"Profit",0
3 - slider 3
50-initial slider value
0 - minimum slider value
200 - maximum slider value ->Not being enforced - unless I just don't understand how sliders are meant to work. I would expect that by sliding this all the way to the right that values would increase from 0 to 200. What happens is the test begins at 50, and after touching the slider the value adjusts to 200 and can be increased beyond that. However it is no longer possible to reduce the value below 200 with the slider unless the test is reset. That seems like a bug.
name - expecting "Profit" instead I see "Slider 3"
0 - no tooltip
Posted By: EvidenceBasedFx

Re: Workshop - Branches and Loops - 10/27/19 21:04

Ok, the bug is mine because the investment calculator works and when I copy&paste your code it also works. I was missing a parameter value is the problem. Sorry for wasting your time! I wish I could say it will be the last time but I doubt it.
© 2024 lite-C Forums