1 registered members (AndrewAMD),
684
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Slider
#470709
01/31/18 23:02
01/31/18 23:02
|
Joined: Dec 2017
Posts: 129 Halifax, NS
kujo
OP
Member
|
OP
Member
Joined: Dec 2017
Posts: 129
Halifax, NS
|
Manual says on the Slider's page the following: The sliders jump to their default positions (pos parameter) when the script is started the first time, or when [Script], [Asset], or [Edit] was clicked. Otherwise the sliders keep their previous position. For testing a script with a certain slider position, click [Test], wait until the sliders appear, then click [Stop], put the sliders to the desired position and click [Test] again. In [Trade] mode the sliders are stored in the .trd file and thus always 'remember' their last position. It seems that this part isn't true anymore: or when [Script], [Asset], or [Edit] was clicked This part is a bit inaccurate: For testing a script with a certain slider position, click [Test], wait until the sliders appear, then click [Stop], put the sliders to the desired position and click [Test] again. It isn't enough to simply wait until the sliders appear. One should wait until the INITRUN is over and "Test: <script name>" message appears. When it comes to the Trade mode, the logic is different and .trd file is used as mentioned in the manual. But what happens during the first run of a strategy when there is no trd file? According to my observations, when running a script for the first time in the Trade mode a desired slider position could be set using 2 options: - 1st option: Start Test. Wait until INITRUN is over and "Test: ..." message is shown. Stop it. Set the slider. Then Trade a script. The slider won't be overwritten by the default value.
- 2nd option. Run a script with the default slider in the Trade mode. Simply change the slider while running in the Trade mode.
|
|
|
Re: Slider
[Re: jcl]
#470716
02/01/18 11:14
02/01/18 11:14
|
Joined: Dec 2017
Posts: 129 Halifax, NS
kujo
OP
Member
|
OP
Member
Joined: Dec 2017
Posts: 129
Halifax, NS
|
You can move a slider as soon as it appears. Indeed, if you move it during run without hitting Stop. However, if you click Stop it's a different story. See below For testing a script with a certain slider position, click [Test], wait until the sliders appear, then click [Stop], put the sliders to the desired position and click [Test] again. I've tried this with my script and logged every step. It doesn't work if I click Stop immediately after the slider appear. I change the slider but after I reTest a script the slider returns back. Above mentioned condition isn't enough. One should wait a bit longer and then hit Stop.
Last edited by kujo; 02/01/18 11:30.
|
|
|
Re: Slider
[Re: kujo]
#470789
02/06/18 16:20
02/06/18 16:20
|
Joined: Dec 2017
Posts: 129 Halifax, NS
kujo
OP
Member
|
OP
Member
Joined: Dec 2017
Posts: 129
Halifax, NS
|
Aside from above-mentioned there is one more question If the script needs to be recompiled, or if it contains any global or static variables that must be reset, click [Edit] before [Test]. This also resets the sliders to their default values. Otherwise the static and global variables and the sliders keep their settings from the previous test run. Clicking Edit doesn't work as stated. So, what's the legit method to reset sliders and variables now? Should I click Edit and then Run in N++ to start a new instance of Zorro?
Last edited by kujo; 02/06/18 16:24.
|
|
|
Re: Slider
[Re: jcl]
#470818
02/07/18 15:48
02/07/18 15:48
|
Joined: Dec 2017
Posts: 129 Halifax, NS
kujo
OP
Member
|
OP
Member
Joined: Dec 2017
Posts: 129
Halifax, NS
|
To recompile and reset sliders and variables, click [Edit], then [Test]. Or click on the script scrollbox and select the script again. What did not work? Oh, shoot! It does work. Sorry for confusion! The only thing that doesn't work is: For testing a script with a certain slider position, click [Test], wait until the slider names appear, then click [Stop], put the sliders to the desired position and click [Test] again. Try this: - Start Zorro - Select Z3 - Click Test and immediately after the sliders names appear click Stop - Change Capital to 2100 - Click Test - Capital is back to 2000 I just want to say that it's not enough to wait until sliders names appear, you should wait a little bit longer. That's it
|
|
|
Re: Slider
[Re: kujo]
#480001
05/12/20 15:55
05/12/20 15:55
|
Joined: Feb 2016
Posts: 15 Milan, Italy
fsgi
Newbie
|
Newbie
Joined: Feb 2016
Posts: 15
Milan, Italy
|
Dear jcl, this seems not to work as expected. If I for instance code something like this: void main()
{
slider(1, 0, 0, 100, "Test");
slider(1, 0); //it should be useless
printf("\nSlider value: %i", slider(1));
int slider_output = 0;
int count = 0;
while(slider_output == 0)
{
if(count % 100 == 0)
{
printf("\n### Change value of slider 1 ###");
}
wait(1000);
slider_output = slider(1);
count++;
}
printf("\nnow slider has value: %i", slider_output);
quit();
} ... when I run it , it produces a nice output: Slider value: 0
### Change value of slider 1 ###
now slider has value: 3
Quit But then, as soon as I re-run the script without recompiling/shutting down Zorro/changing scritp, without touching ANYTHING (e.g. not shifting the slider back in the GUI), I still obtain Slider value: 0
### Change value of slider 1 ###
now slider has value: 3
Quit ...meaning that the GUI "fixed" slider is not reset programmatically and that it overwrites (or immediately changes back the programmatically-set slider value) to its position... This was what I meant.
|
|
|
|