Steve's first programing lesson

Post Reply
User avatar
Mike
Trader
Posts: 272
Joined: Sun Dec 11, 2011 12:30 pm
Location: Italy

Steve's first programing lesson

Post by Mike »

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
You do not have the required permissions to view the files attached to this post.
Image
Image
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Steve's first programing lesson

Post by SteveHopwood »

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:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
Mike
Trader
Posts: 272
Joined: Sun Dec 11, 2011 12:30 pm
Location: Italy

Steve's first programing lesson

Post by Mike »

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
Image
Image
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Steve's first programing lession

Post by SteveHopwood »

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:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
Post Reply

Return to “Coders Hangout”