Coding Forum Thread, Automatic Pivots Calculation - Help in Trading Resources; Hi Chloe
Take a look at this simple code. It plots Camarilla Lines and Yesterdays OHLC(Open rem out)
Perhaps put ...  | | | | Re: Automatic Pivots Calculation - Help

02-16-2010, 12:00 PM
| | | | Join Date: Oct 2009 Location: Port St Lucie
Posts: 49
Thanks: 10
Thanked 22 Times in 17 Posts
| | Hi Chloe
Take a look at this simple code. It plots Camarilla Lines and Yesterdays OHLC(Open rem out)
Perhaps put this on your other contracts and if it works for you then you can modify the arithmetic to account for your pivots.
If you need some additional help - check me back!
{Plots previous day Hi/Low/Close - Open {x} Out below}
{Plots Camarilla Lines}
{Rev date 07Aug09}
variables:
var0( 0 ) ,
var1( 0 ) ,
var2( 0 ) ,
var3( 0 ) ,
var4( 0 ) ,
var5( 0 ) ,
var6( 0 ) ,
var7( 0 ) ,
var8( 0 ) ;
if Date <> Date[1] then
begin
var0 = var0 + 1 ;
var1 = var2 ;
var3 = var4 ;
var5 = var6 ;
var7 = Close[1] ;
var2 = Open ;
var4 = High ;
var6 = Low ;
end
else
begin
if High > var4 then
var4 = High ;
if Low < var6 then
var6 = Low ;
end ;
condition1 = var0 >= 2 and BarType < 3 ;
value10 = ((var3 - var5)*(1.1/2)) + var7 ; {H4}
value20 = ((var3 - var5)*(1.1/4)) + var7 ; {H3}
value30 = ((var3 - var5)*(1.1/6)) + var7 ; {H2}
value40 = ((var3 - var5)*(1.1/12)) + var7 ; {H1}
value50 = var7 - ((var3 - var5)*(1.1/12)) ;{L1}
value60 = var7 - ((var3 - var5)*(1.1/6)) ;{L2}
value70 = var7 - ((var3 - var5)*(1.1/4)) ;{L3}
value80 = var7 - ((var3 - var5)*(1.1/2)) ; {L4}
if condition1 then
begin
Plot1( var1, "Y-O" ) ;
Plot2( var3, "Y-H" ) ;
Plot3( var5, "Y-L" ) ;
Plot4( var7, "Y-C" ) ;
Plot10( value10, "H4" ) ;
Plot20( value20, "H3" ) ;
Plot30( value30, "H2" ) ;
Plot40( value40, "H1" ) ;
Plot50( value50, "L1" ) ;
Plot60( value60, "L2" ) ;
Plot70( value70, "L3" ) ;
Plot80( value80, "L4" ) ;
end ; | Re: Automatic Pivots Calculation - Help

02-16-2010, 02:46 PM
| | | | Join Date: Mar 2009 Location: Toulouse
Posts: 24
Thanks: 13
Thanked 2 Times in 2 Posts
| | Hello Ranger,
Thank you very much for you help, I really appreciated.
I tried your code on CL contract (Mar 10)
Today is Tuesday. So, the session on CL started at 6.00 pm (EST time) and will end on Wednesday at 5.15 pm (EST time).
The previous session started at 6.00 pm (EST time) on Monday and ended on Tuesday at 5.15 pm (EST time).
To calculate the pivot points, I need the High, the Low and the Close pf the session that started at 6.00 pm (EST time) on Monday and ended on Tuesday at 5.15 pm (EST time). These values are as follows:
- High = 74.36
- Low = 73.71
- Close = 73.96
I tried your code, but it seems that your pivots are calculated on a session that starts at 12 am and ends at 11.59 p.m the same day. Am I right ?
How can I modify it to calculate pivots on a session that starts at 6.00 pm (EST time) on Monday and ends on Tuesday at 5.15 pm (EST time) ?
Many thanks in advance for your help
Bets regards,
Chloe | Re: Automatic Pivots Calculation - Help

02-16-2010, 03:00 PM
| | | | Join Date: Nov 2006 Location: N/A
Posts: 607
Thanks: 62
Thanked 271 Times in 168 Posts
| |
Originally Posted by chloe31 Hello Ranger,
Thank you very much for you help, I really appreciated.
I tried your code on CL contract (Mar 10)
Today is Tuesday. So, the session on CL started at 6.00 pm (EST time) and will end on Wednesday at 5.15 pm (EST time).
The previous session started at 6.00 pm (EST time) on Monday and ended on Tuesday at 5.15 pm (EST time).
To calculate the pivot points, I need the High, the Low and the Close pf the session that started at 6.00 pm (EST time) on Monday and ended on Tuesday at 5.15 pm (EST time). These values are as follows:
- High = 74.36
- Low = 73.71
- Close = 73.96
I tried your code, but it seems that your pivots are calculated on a session that starts at 12 am and ends at 11.59 p.m the same day. Am I right ? How can I modify it to calculate pivots on a session that starts at 6.00 pm (EST time) on Monday and ends on Tuesday at 5.15 pm (EST time) ?
Many thanks in advance for your help
Bets regards,
Chloe | Doesn't the thread we referred you to, explains exactly that with Globex High/Low? Other than wanting someone to write the code for you, since the answer was already provided, I am not sure what more you are looking for? | Re: Automatic Pivots Calculation - Help

02-16-2010, 03:15 PM
| | | | Join Date: Mar 2009 Location: Toulouse
Posts: 24
Thanks: 13
Thanked 2 Times in 2 Posts
| | Sevensa,
I am really sorry but:
1) today, I have no time to go to the Thread you advise me.
2) Ranger wrote: If you need some additional help - check me back!, that is the reason why I asked him my question: How can I modify it to calculate pivots on a session that starts at 6.00 pm (EST time) on Monday and ends on Tuesday at 5.15 pm (EST time) ?
I will try to code something based on the Thread you advise me, but not before this week-end.
Chloe | Re: Automatic Pivots Calculation - Help

02-16-2010, 09:24 PM
| | | | Join Date: Oct 2009 Location: Port St Lucie
Posts: 49
Thanks: 10
Thanked 22 Times in 17 Posts
| | Hi Chloe
Oh Boy ... you may need to renew your fan base. Perhaps send them chocolate chip cookies or hemlock ;o)
OK, I understand the issue more clearly .... let me see, if I can help you.
Cheers!!! michael | Re: Automatic Pivots Calculation - Help

02-17-2010, 04:14 AM
| | | | Join Date: Mar 2007 Location: In Da House
Posts: 2,817
Thanks: 106
Thanked 809 Times in 552 Posts
| | Chloe I think the reason people are reticent is that you are expecting them to spend time to help but you are "too busy" to try to help yourself. I guess you can see how this might look lazy? If you are too busy to devote any time to this then perhaps you should wait until you have half an hour or so to spare?
The thread has the answers you seek. If you have difficulty understanding them then I am sure people will help you. They are unlikely to help if you have not done anything to help yourself. Actually strike that, looks like you have got ranger to waste there time re-inventing the wheel for you. | | The Following 2 Users Say Thank You to BlowFish For This Useful Post: | | Re: Automatic Pivots Calculation - Help

02-17-2010, 10:38 AM
| | | | Join Date: Feb 2008 Location: charleston
Posts: 41
Thanks: 6
Thanked 12 Times in 10 Posts
| | added inputs for session times
{Plots previous day Hi/Low/Close - Open {x} Out below}
{Plots Camarilla Lines}
{Rev date 07Aug09}
input: SessStart(1803),SessEND(1615);
variables:
var0( 0 ) ,
var1( 0 ) ,
var2( 0 ) ,
var3( 0 ) ,
var4( 0 ) ,
var5( 0 ) ,
var6( 0 ) ,
var7( 0 ) ,
var8( 0 ) ,
SessReset( False ) ,
CamarillaReset( False ) ;
SessReset = t = SessEnd;
CamarillaReset = t = SessStart;
if SessReset then
begin
var0 = var0 + 1 ;
var1 = var2 ;
var3 = var4 ;
var5 = var6 ;
var7 = Close;
end;
if CamarillaReset then
begin
var2 = Open ;
var4 = High ;
var6 = Low ;
end
else
begin
if High > var4 then
var4 = High ;
if Low < var6 then
var6 = Low ;
end ;
condition1 = var0 >= 2 and BarType < 3 ;
value10 = ((var3 - var5)*(1.1/2)) + var7 ; {H4}
value20 = ((var3 - var5)*(1.1/4)) + var7 ; {H3}
value30 = ((var3 - var5)*(1.1/6)) + var7 ; {H2}
value40 = ((var3 - var5)*(1.1/12)) + var7 ; {H1}
value50 = var7 - ((var3 - var5)*(1.1/12)) ;{L1}
value60 = var7 - ((var3 - var5)*(1.1/6)) ;{L2}
value70 = var7 - ((var3 - var5)*(1.1/4)) ;{L3}
value80 = var7 - ((var3 - var5)*(1.1/2)) ; {L4}
if condition1 then
begin
Plot1( var1, "Y-O" ) ;
Plot2( var3, "Y-H" ) ;
Plot3( var5, "Y-L" ) ;
Plot4( var7, "Y-C" ) ;
Plot10( value10, "H4" ) ;
Plot20( value20, "H3" ) ;
Plot30( value30, "H2" ) ;
Plot40( value40, "H1" ) ;
Plot50( value50, "L1" ) ;
Plot60( value60, "L2" ) ;
Plot70( value70, "L3" ) ;
Plot80( value80, "L4" ) ;
end ;
| | | The Following User Says Thank You to statsign For This Useful Post: | | Re: Automatic Pivots Calculation - Help

02-17-2010, 10:46 AM
| | | | Join Date: Oct 2009 Location: Port St Lucie
Posts: 49
Thanks: 10
Thanked 22 Times in 17 Posts
| |
Originally Posted by BlowFish Chloe I think the reason people are reticent is that you are expecting them to spend time to help but you are "too busy" to try to help yourself. I guess you can see how this might look lazy? If you are too busy to devote any time to this then perhaps you should wait until you have half an hour or so to spare?
The thread has the answers you seek. If you have difficulty understanding them then I am sure people will help you. They are unlikely to help if you have not done anything to help yourself. Actually strike that, looks like you have got ranger to waste there time re-inventing the wheel for you. | Blow Fish
Actually Blow Fish, if I consider it time well spent, how can you judge from me that it's a waste of my time? If I can help Chloe, I will and thanks for mentioning the link again... I'll check it.
Anyway, I know that you're a good contributor as are the others and thanks for the comments.
And it's Ranger not ranger. | | The Following User Says Thank You to Ranger For This Useful Post: | | Re: Automatic Pivots Calculation - Help

02-17-2010, 02:51 PM
| | | | Join Date: Mar 2009 Location: Toulouse
Posts: 24
Thanks: 13
Thanked 2 Times in 2 Posts
| | Hello Everybody,
@Blowfish,
I have well understood your message. As I have already written, I will try to work this week-end in order to code something, based on your inputs (threat ,..).
Nevertheless, can you tell me what is the interest to have a coding forum here if we cannot request help for coding without being critisized ?
@Ranger,
Many thanks for your help, but I do not want you to sprend a lot of time on this code. I do not want you to waste you time. I do not know how to thank you !
@ Statsign,
Thank you very much for having modified the code coming from Ranger. I do not know how to thank you !
I will try this code this week-end, and I will try to code something.
I will keep you informed.
Thank you a lot !
Best regards
Chloe | Re: Automatic Pivots Calculation - Help

02-18-2010, 11:22 AM
| | | | Join Date: Mar 2007 Location: In Da House
Posts: 2,817
Thanks: 106
Thanked 809 Times in 552 Posts
| |
Originally Posted by Ranger Blow Fish
Actually Blow Fish, if I consider it time well spent, how can you judge from me that it's a waste of my time? If I can help Chloe, I will and thanks for mentioning the link again... I'll check it.
Anyway, I know that you're a good contributor as are the others and thanks for the comments.
And it's Ranger not ranger. | Edit: I should say this is not to chastise Chloe, they seem to have had the brunt of it recently  Simply in response to Ranger.
It's your time do as you please with it  If you will learn something from it great. If you want to help someone that is to 'busy' to help themselves that is fine too.
The aforementioned thread has 2 or 3 (or maybe more) solutions to the problem presented.
Give a man a fish and you feed him for a day teach a man to fish and you feed him for life. You can lead a horse to water but you can not make him drink. Ok enough of the proverbs already.
I would have posted code that plot pivots, mid points, labels, price labels, irregular sessions, split sessions, multiple sessions (e.g. 2.5 days 5 days) weekly pivots, monthly pivots, etc. etc. Unfortunately I am a little busy right now.
Last edited by BlowFish; 02-18-2010 at 11:31 AM.
|  | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |