[PL] Divergence with multiple pivots points

Questions about MultiCharts and user contributed studies.
duration
Posts: 175
Joined: 20 Dec 2005

[PL] Divergence with multiple pivots points

Postby duration » 21 Apr 2010

Hello All,

I am still working on the Marplex Tutorial 26:

http://markplex.com/tutorial26.php
http://forum.tssupport.com/viewtopic.php?t=7316

I have attached two screenshots.

The first one (pivoti2.png) is with a default instance of 1 (tl end) & 2 (tl begin), and it picks up the divergence accordingly.

The second one (pivoti3.png) is with an instance of 1 (tl end) & 3 (tl begin) and it picks the divergence accordingly, but not the divergence from pivoti2.png, and this is normal.

I would like the code to pick up both divergences, and also divergences with further pivot points (instances of 4, 5 etc.) and I am wondering what is the most efficient solution:


1. plainly programme each possible case: each of 1&2, and 1&3, 1&4 etc.

2. using a loop, for example: once a pivot is found, look back for every pivot point and if one of them coincide with a pivot on the stochastic, then draw a line etc.

3. a smarter way of doing this?

TJ kindly taught me how to use loops and display what they do, hopefully this thread won't reach 99 posts like the previous one!

Many thanks!
Attachments
pivoti2.png
default settings
pivoti2.png (136.62 KiB) Viewed 187 times
pivoti3.png
longer divergence
pivoti3.png (139.8 KiB) Viewed 190 times
markplex26.txt
the code from markplex
(2.19 KiB) Downloaded 55 times

glen demarco
Posts: 35
Joined: 16 Nov 2009
Contact:

Postby glen demarco » 21 Apr 2010

If you could be so kind as to post the code with tabs inserted, I'd be happy to look at it. Right now the test file download as one single line of code ans with comments it's difficult to beark it up line by line.

Thanks

User avatar
Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:

Postby Bruce DeVault » 21 Apr 2010

I think it might just be an upload issue. Try downloading the file to your desktop, then opening it in Wordpad and saving it again, and the CRLFs should be restored.

glen demarco
Posts: 35
Joined: 16 Nov 2009
Contact:

Postby glen demarco » 21 Apr 2010

Hi Bruce,

BTW your posts are awesome, thanks for all the help. Was that wordpad suggestion meant for me or duration? The carriage return line feed characters aren't in the txt file that I downloaded.


While we are on the topic. Any suggestions for printing a listing of all the signals in my multicharts directory. If I go through the power language editior I can obviously open and print each, but there title on the page of code and for hundreds of signals it would be nice to know the signal name as identified and listed in multicharts. Some do imbed the name in the source but most do not.

Any ideas for exporting the code into a directory and using windows or some other utility.


thanks you glen

duration
Posts: 175
Joined: 20 Dec 2005

Postby duration » 22 Apr 2010

Hi Glen,

Thank you for your message!

Is the code easier to read this way?

Code: Select all

// http://markplex.com/tutorial26.php

inputs :
   PriceL(Low),
   StochLength(7),
   SmoothingLength1(3),
   SmoothingLength2(3),
   SmoothingType(1),
   Length(20),
   LeftStrength(3),
   RightStrength(1),
   BarTol(3);


vars:
   ofastk(0),
   oFastD(0),
   oSlowk(0),
   oSlowD(0),
   oPivotPrice1(0),
   oPivotBar1(0),
   oPivotPrice2(0),
   oPivotBar2(0),
   oPivotPrice3(0),
   oPivotBar3(0),
   oPivotPrice4(0),
   oPivotBar4(0),
   tlslope(0),
   bback(0),
   tlvalue(0),
   pricepivotcondition1(false),
   pricepivotcondition2(false),
   stochpivotcondition1(false),
   stochpivotcondition2(false),
   stochvalue(0),
   tlstoch(0),
   tlprice(0),
   tldistance(0),
   stylecon01(false);


stochvalue=Stochastic(H,L,C,StochLength,SmoothingLength1,SmoothingLength2,SmoothingType,ofastk,ofastd,oslowk,oslowd);

//Determine if pivots in the stochstic have occurred
stochpivotcondition1 = Pivot(oslowd,Length,LeftStrength,RightStrength,1,-1,oPivotPrice1,oPivotBar1)<>-1;
stochpivotcondition2 = Pivot(oslowd,Length,LeftStrength,RightStrength,2,-1,oPivotPrice2,oPivotBar2)<>-1;

//Determine if pivots in the price have occurred
pricepivotcondition1 = Pivot(PriceL,Length,LeftStrength,RightStrength,1,-1,oPivotPrice3,oPivotBar3)<>-1;
pricepivotcondition2 = Pivot(PriceL,Length,LeftStrength,RightStrength,2,-1,oPivotPrice4,oPivotBar4)<>-1;



if pricepivotcondition1 and pricepivotcondition2 and stochpivotcondition1 and stochpivotcondition2
and (absvalue(oPivotbar1-oPivotBar3)<BarTol)
and (absvalue(oPivotbar2-oPivotBar4)<BarTol)
and (oPivotBar3 <= oPivotBar1)
and (oPivotBar3 = RightStrength or oPivotbar1 = RightStrength)
and (oPivotPrice3<=oPivotPrice4 and oPivotPrice1>oPivotPrice2) and barstatus(1)=2 then
      begin

      tlprice=tl_new_S(D[oPivotBar4],Time_S[oPivotBar4],L[oPivotBar4],D[oPivotBar3],Time_s[oPivotBar3],L[oPivotBar3]);
      tl_setcolor(tlprice,yellow);
      tl_setsize(tlprice,1);
      tl_setstyle(tlprice,2);
     
      tlstoch= tl_new_Self_s(D[oPivotBar1],Time_S[oPivotBar1],oPivotPrice1,D[oPivotBar2],Time_s[oPivotBar2],oPivotPrice2);
      tl_setcolor(tlstoch,Green);
      tl_setsize   (tlstoch,1);
      end;
     
      Plot1(oSlowD);
      Plot2[oPivotBar1](oPivotPrice1,"PL");

User avatar
Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:

Postby Bruce DeVault » 22 Apr 2010

I was simply trying to be helpful for either of you. Thanks so much for your kind words, I appreciate it.

I'm afraid I don't know of a way to print the EL database or a summary of each - I think that would be a really great suggestion. Most I believe who have source code tracking end up doing this in a more manual way, until the tools get to a point where this kind of thing can be automated.

User avatar
TJ
Posts: 6520
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: [PL] Divergence with multiple pivots points

Postby TJ » 23 Apr 2010

... hopefully this thread won't reach 99 posts like the previous one!

Many thanks!


you got your wish.

;-)


Return to “MultiCharts”