Hi all,
I'm very interested in trading around the 50% level of certain candles.
Currently, I have to select the candle, drag a fib on it, make sure the 0 and 100 levels are bang on correct, then draw my horizontal trendline [with ray] on the 50%.
I wondered if there's such a thing as a script where I can just drag something to the specific candle and it draws the line automatically at 50%? Would make the process SOOOO much faster!!
Thanks in advance guys!
Rob
Script to draw line at 50% of candle
-
mrpipstrader
- Trader
- Posts: 23
- Joined: Wed Nov 16, 2011 3:42 pm
Script to draw line at 50% of candle
Hi Rob,
What you need can probably be derived from this SHF thread by happytrader http://www.stevehopwoodforex.com/phpBB3 ... =48&t=2086 - "Simple script to snap lines to high or low of candles".
His script does more than high and low lines in the title. For your purposes pay particular attention to his MyMidLine variable and calculation. The complete script is near the end of the thread and you should be able to adapt this to whatever you want. It seems obvious even to a non-coder like me.
Cheers,
mrpipstrader
What you need can probably be derived from this SHF thread by happytrader http://www.stevehopwoodforex.com/phpBB3 ... =48&t=2086 - "Simple script to snap lines to high or low of candles".
His script does more than high and low lines in the title. For your purposes pay particular attention to his MyMidLine variable and calculation. The complete script is near the end of the thread and you should be able to adapt this to whatever you want. It seems obvious even to a non-coder like me.
Cheers,
mrpipstrader
-
GT3RS
- Trader
- Posts: 198
- Joined: Fri Dec 23, 2011 1:58 pm
Script to draw line at 50% of candle
Many thanks mate!
Just looking at it makes my head spin though!!
Will try to figure it all out. If you don't hear anything more on this thread, assume I've cracked it!! [highly unlikely!!!]
Cheers,
Rob
Just looking at it makes my head spin though!!
Will try to figure it all out. If you don't hear anything more on this thread, assume I've cracked it!! [highly unlikely!!!]
Cheers,
Rob
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Script to draw line at 50% of candle
Here you go. It only took a minute. You have been a member for a long time and I do not recall you endlessly jumping up and down demanding stuff, so take it with my blessing. I hope it helps you.
CandleShift is the candle you want to look at. The default of 1 means the previous candle. The rest I leave you to work out for yourself.

CandleShift is the candle you want to look at. The default of 1 means the previous candle. The rest I leave you to work out for yourself.
You do not have the required permissions to view the files attached to this post.
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.
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.
-
GT3RS
- Trader
- Posts: 198
- Joined: Fri Dec 23, 2011 1:58 pm
Script to draw line at 50% of candle
Wow!!
Many thanks Steve! Works a treat!!!
Many thanks Steve! Works a treat!!!
-
GT3RS
- Trader
- Posts: 198
- Joined: Fri Dec 23, 2011 1:58 pm
Script to draw line at 50% of candle
Steve, maybe you shouldn't have helped, because now I AM jumping up and down, demanding things!!!
When I use your wonderful [!] script on the same chart more than once, I have to give the each trendline its own object name manually. Otherwise the script deletes the first one and then draws the new one.
Is it possible to give each instance it's own object name/number in order to avoid this?
Not a major problem if it can't be done.
Thanks once again!
Rob
When I use your wonderful [!] script on the same chart more than once, I have to give the each trendline its own object name manually. Otherwise the script deletes the first one and then draws the new one.
Is it possible to give each instance it's own object name/number in order to avoid this?
Not a major problem if it can't be done.
Thanks once again!
Rob
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Script to draw line at 50% of candle
Here you are.
Each trendline has its own unique name. This was the time and date the line was created, converted to a string and using the broker's time. This does not work over the weekend because the broker's time does not change. This version uses your own local time, so each line name is different.

Each trendline has its own unique name. This was the time and date the line was created, converted to a string and using the broker's time. This does not work over the weekend because the broker's time does not change. This version uses your own local time, so each line name is different.
You do not have the required permissions to view the files attached to this post.
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.
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.
-
GT3RS
- Trader
- Posts: 198
- Joined: Fri Dec 23, 2011 1:58 pm
Script to draw line at 50% of candle
Perfect!!!
Many thanks once again Steve!
Many thanks once again Steve!
-
GT3RS
- Trader
- Posts: 198
- Joined: Fri Dec 23, 2011 1:58 pm
Script to draw line at 50% of candle
This really is a great tool for me and my trading. I have even managed to change it, so that I can draw a line from the high or low of a candle. AMAZING coding skills by me!!!
When I have refined some more, I will share what I am doing.
In the meantime, would any of you wonderful coders like to assist a little bit further?
1. It would be fantastic to have push notifications from this script.
2. It would be equally fantastic to have it so that it only shows the line it creates, on the timeframe it is created on, and all timeframes below that one.
3. Finally, what would be MEGA fantastic [!], would be to have it draw the lines in different colours for different timeframes.
If anyone is able to help, I'd be extremely grateful. I guess no.1 is the most important, with no.s 2 and 3 being "nice to haves."
I've attached the 3 scripts: One for 50% of the candle and the other 2 for hi and lo, respectively.
Many thanks in advance,
Rob
When I have refined some more, I will share what I am doing.
In the meantime, would any of you wonderful coders like to assist a little bit further?
1. It would be fantastic to have push notifications from this script.
2. It would be equally fantastic to have it so that it only shows the line it creates, on the timeframe it is created on, and all timeframes below that one.
3. Finally, what would be MEGA fantastic [!], would be to have it draw the lines in different colours for different timeframes.
If anyone is able to help, I'd be extremely grateful. I guess no.1 is the most important, with no.s 2 and 3 being "nice to haves."
I've attached the 3 scripts: One for 50% of the candle and the other 2 for hi and lo, respectively.
Many thanks in advance,
Rob
You do not have the required permissions to view the files attached to this post.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Script to draw line at 50% of candle
Why not see if you can sort it out for yourself - an excellent way to learn.
Load the attached into the editor and do a search for "// Enable to send push notification on alert" to take you to the inputs.
Then do a search for the AlertPush input to take you to the places where calls are sent to the AlertNow() function that sends the call.
Then do a search for the AlertSent variable. This will show you how it is used to avoid multiple pushes and how to turn it off at the open of a new candle.

Load the attached into the editor and do a search for "// Enable to send push notification on alert" to take you to the inputs.
Then do a search for the AlertPush input to take you to the places where calls are sent to the AlertNow() function that sends the call.
Then do a search for the AlertSent variable. This will show you how it is used to avoid multiple pushes and how to turn it off at the open of a new candle.
You do not have the required permissions to view the files attached to this post.
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.
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.