stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Steve's first programing lesson
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4048
Page 1 of 1
Author:  Mike [ Wed Jan 14, 2015 5:35 pm ]
Post subject:  Steve's first programing lesson

Some of you might have followed Steve's invitation to try to modify his script "Market long" at the beginning of their programming career. Thanks for the detailed description.
I try to trade with Scripts but sometimes I forget I have them on or imagine they are still on. Since I forget faster than I imagine, I would like to see on the chart a note "....", that remembers me: the script is running. Ok I got the script to do this (see attachment) :D (In case it should not compile I have saved a Metaeditor 5.00, which works fine with most old Indis and Scripts). If the script would need some updating, feel free to do so.
Now - as you see appetite grows - I would like three different options and do not know how to accomplish them:
Option 1. after the script has done its job, the note disappears
Option 2. after the script has done its job, the note changes to: "job done"
Option 3. the script does not disappear, when I change TF.
I understand that Scripts are programs that are intended to perform a single action: a Script stops functioning once it has completed its function one time. Does option 1 define one action, because they happen simultaneously or are they distinct single actions, which cannot be programmed as a Script? Same question for option 2. Option 3 is from what I understand not possible, but I'm not sure.
Thanks for your help, Mike
Author:  SteveHopwood [ Wed Jan 14, 2015 11:44 pm ]
Post subject:  Steve's first programing lesson

Mike » Wed Jan 14, 2015 5:35 pm wrote:Some of you might have followed Steve's invitation to try to modify his script "Market long" at the beginning of their programming career. Thanks for the detailed description.
I try to trade with Scripts but sometimes I forget I have them on or imagine they are still on. Since I forget faster than I imagine, I would like to see on the chart a note "....", that remembers me: the script is running. Ok I got the script to do this (see attachment) :D (In case it should not compile I have saved a Metaeditor 5.00, which works fine with most old Indis and Scripts). If the script would need some updating, feel free to do so.
Now - as you see appetite grows - I would like three different options and do not know how to accomplish them:
Option 1. after the script has done its job, the note disappears
Option 2. after the script has done its job, the note changes to: "job done"
Option 3. the script does not disappear, when I change TF.
I understand that Scripts are programs that are intended to perform a single action: a Script stops functioning once it has completed its function one time. Does option 1 define one action, because they happen simultaneously or are they distinct single actions, which cannot be programmed as a Script? Same question for option 2. Option 3 is from what I understand not possible, but I'm not sure.
Thanks for your help, Mike
Great to see you getting your hands dirty. :clap: Here we go:
Option 1. after the script has done its job, the note disappears
You put

Code: Select all

Comment("");
into OnDeinit()
Option 2. after the script has done its job, the note changes to: "job done"
You put

Code: Select all

Comment("Job done");
into OnDeinit()
Option 3. the script does not disappear, when I change TF.
Cannot be done. Actually it can, but then you are getting into endless loops and treating a script rather more like an EA - and you really don't want to go there until you know what you are doing. For now, just accept that a script is a run-once thingy.

Have fun. You are starting out just like I did 8 years ago, and look where I am now.

:xm:
Author:  Mike [ Thu Jan 15, 2015 8:19 am ]
Post subject:  Steve's first programing lesson

SteveHopwood » Thu Jan 15, 2015 12:44 am wrote:
Have fun. You are starting out just like I did 8 years ago, and look where I am now.

:xm:
Thanks, I didn't expect his masters voice. I will try and see how far I'll get, Mike
Author:  SteveHopwood [ Thu Jan 15, 2015 8:48 am ]
Post subject:  Steve's first programing lession

I forgot we were talking about a script here, which does not have an OnDeinit() function.

The code to produce the comments would go at the end of the program.

:xm:
All times are UTC Page 1 of 1