here it is: p.s. this is not pesavento. It only labels HH, HL, etc. PHP: inputs: LeftStrength( 3 ) , RightStrength( 3 ), LookBackLength( 100 ) ; variable: ID(-1), Offset( 0 ) , HighValue1(0), HighValue2(0), LowValue1(0), LowValue2(0), Value1(0); Offset = .15 * Average( Range, 5 ) ; if PivotHighVSBar( 1, High, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then begin HighValue1 = PivotHighVS(1, High, Leftstrength, RightStrength, LookBackLength ); HighValue2 = PivotHighVS(2, High, Leftstrength, RightStrength, LookBackLength ); if HighValue2 <> -1 and ( ( HighValue1 >= HighValue2 - Offset ) and ( HighValue1 <= HighValue2 + Offset ) ) then begin ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, "DT"); Text_SetStyle(ID, 2, 1 ) ; Text_SetColor(ID, yellow); Value1 = 1; end ; if HighValue2 <> -1 and HighValue1 > HighValue2 and value1 = 0 then begin ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, "HH"); Text_SetStyle(ID, 2, 1 ) ; Text_SetColor(ID, Green); end else if HighValue2 <> -1 and HighValue1 < HighValue2 and value1 = 0 then begin ID = Text_New(Date[RightStrength], Time[Rightstrength], High[RightStrength] + Offset, "LH"); Text_SetStyle(ID, 2, 1 ) ; Text_SetColor(ID, Red); end ; Value1 = 0; end ; if PivotLowVSBar( 1, Low, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then begin LowValue1 = PivotLowVS(1, Low, Leftstrength, RightStrength, LookBackLength ); LowValue2 = PivotLowVS(2, Low, Leftstrength, RightStrength, LookBackLength ); if LowValue2 <> -1 and ( ( LowValue1 >= LowValue2 - Offset ) and ( LowValue1 <= LowValue2 + Offset ) ) then begin ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "DB"); Text_SetStyle(ID, 2, 0 ) ; Text_SetColor(ID, yellow); Value1 = 1; end; if LowValue2 <> -1 and LowValue1 < LowValue2 and Value1 = 0 then begin ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "LL"); Text_SetStyle(ID, 2, 0 ) ; Text_SetColor(ID, Red); end else if LowValue2 <> -1 and LowValue1 > LowValue2 and Value1 = 0 then begin ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "HL"); Text_SetStyle(ID, 2, 0 ) ; Text_SetColor(ID, Green); end; Value1 = 0; end ;
Pesavento pattern should look something like this: <img src=http://elitetrader.com/vb/attachment.php?s=&postid=2163043 width=800> click on attachment to enlarge
Thanks for your reply Tums! I was thinking about an indicator just like the one you attached, which labels HH/HL etc! Excellent However the code did not work like it should on my OEC plattfom, i reacived error calls on some of the words when compiling it. I have attached a photo of them. Are you using OEC Tums?
No, I am not using OEC. ohhhkey... about the error message... those are functions... I don't know how you can get them in OEC. here's the code: PHP: {Function: PivotHighVSBar} inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ; variables: var0( 0 ), var1( 0 ) ; Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, 1, var0, var1 ) ; PivotHighVSBar = var1 ; PHP: {Function: PivotHighVS} inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ; variables: var0( 0 ), var1( 0 ) ; Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, 1, var0, var1 ) ; PivotHighVS = var0 ; PHP: {Function: PivotLowVSBar} inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ; variables: var0( 0 ), var1( 0 ) ; Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, -1, var0, var1 ) ; PivotLowVSBar = var1 ; PHP: {Function: PivotLowVS} inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ; variables: var0( 0 ), var1( 0 ) ; Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, -1, var0, var1 ) ; PivotLowVS = var0 ;
Thanks! I do not know how to install functions, so I sent the support-team an email, and hopefully they can guide me in the right direction in how to do this on the OEC plattform.
Started to toy around with this a little. I do not think OEC will be able to plot text like TS does. You will need to go through the code and change it so it plots something. Then i would change that plot to a dot or some other point. As for adding functions: 1) Hightlight Function 2) Right click in OEC complier, select " Add Function". Make sure the name is the same name OEC is looking for. Going to take some time toying around with to get it work. For some reason, its doesnt like Value1 in the variables, so either just get rid of it or figure out why it doesnt like it. Also going to need the pivot function. PHP: inputs: Price( numericseries ), Length( numericsimple ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Instance( numericsimple ), HiLo( numericsimple ), { pass in 1 for PivotHigh(Bar), -1 for PivotLow(Bar) } oPivotPrice( numericref ), oPivotBar( numericref ) ; variables: CandidatePrice( 0 ), LengthCntr( 0 ), StrengthCntr( 0 ), InstanceCntr( 0 ), PivotTest( false ), InstanceTest( false ) ; InstanceCntr = 0 ; InstanceTest = false ; LengthCntr = RightStrength ; while LengthCntr < Length and InstanceTest = false begin { GET NEXT MOST RECENT CandidatePrice & SET STARTING ASSUMPTION THAT IT IS A Pivot: } CandidatePrice = Price[LengthCntr] ; PivotTest = true ; { COMPARE CandidatePrice TO LeftStrength BARS ON LEFT: } StrengthCntr = LengthCntr + 1 ; while PivotTest = true and StrengthCntr - LengthCntr <= LeftStrength begin if ( HiLo = 1 and CandidatePrice < Price[StrengthCntr] ) or ( HiLo = -1 and CandidatePrice > Price[StrengthCntr] ) then PivotTest = false else StrengthCntr = StrengthCntr + 1 ; end ; { IF CandidatePrice SURVIVED LEFT COMPARISON, NOW COMPARE TO RightStrength BARS ON RIGHT: } StrengthCntr = LengthCntr - 1 ; while PivotTest = true and LengthCntr - StrengthCntr <= RightStrength begin if ( HiLo = 1 and CandidatePrice <= Price[StrengthCntr] ) or ( HiLo = -1 and CandidatePrice >= Price[StrengthCntr] ) then PivotTest = false else StrengthCntr = StrengthCntr - 1 ; end ; { IF CandidatePrice SURVIVED OVERALL AS Pivot, INCREMENT InstanceCntr: } if PivotTest = true then InstanceCntr = InstanceCntr + 1 ; { IF InstanceCntr HAS REACHED REQUIRED COUNT, THEN THIS IS THE DESIRED Pivot, ELSE INCREMENT LengthCntr TO PREPARE TO GET AND TEST NEXT CANDIDATE PRICE: } if InstanceCntr = Instance then InstanceTest = true else LengthCntr = LengthCntr + 1 ; end ; if InstanceTest = true then begin oPivotPrice = CandidatePrice ; oPivotBar = LengthCntr + ExecOffset ; Pivot = 1 ; { return 1 if required pivot found } end else begin oPivotPrice = -1 ; oPivotBar = -1 ; Pivot = -1 ; { return -1 if required pivot not found } end ;
coming right up... PHP: {Function: Pivot} inputs: PriceValue( numericseries ), Len( numericsimple ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Instance( numericsimple ), HiLo( numericsimple ), oPivotPriceValue( numericref ), oPivotBar( numericref ) ; variables: var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 ), var4( false ), var5( false ) ; var3 = 0 ; var5 = false ; var1 = RightStrength ; while var1 < Len and var5 = false begin var0 = PriceValue[var1] ; var4 = true ; var2 = var1 + 1 ; while var4 = true and var2 - var1 <= LeftStrength begin condition1 = ( HiLo = 1 and var0 < PriceValue[var2] ) or ( HiLo = -1 and var0 > PriceValue[var2] ) ; if condition1 then var4 = false else var2 = var2 + 1 ; end ; var2 = var1 - 1 ; while var4 = true and var1 - var2 <= RightStrength begin condition1 = ( HiLo = 1 and var0 <= PriceValue[var2] ) or ( HiLo = -1 and var0 >= PriceValue[var2] ) ; if condition1 then var4 = false else var2 = var2 - 1 ; end ; if var4 = true then var3 = var3 + 1 ; if var3 = Instance then var5 = true else var1 = var1 + 1 ; end ; if var5 = true then begin oPivotPriceValue = var0 ; oPivotBar = var1 + ExecOffset ; Pivot = 1 ; end else begin oPivotPriceValue = -1 ; oPivotBar = -1 ; Pivot = -1 ; end ;
LOL, I already attached it. I was able to get it plot the text for "DT", so I guess OEC can do it. however, i tried to get all the others to work and now it wont compile, and dont really feel like working on this right now. So it can be done, just will take some time.
well.. I spoke with the tech-support team today, and they claimed it was some sort of bug in the code. But they did not have the time to do a proper research on the code. They probably refered to some of the same issues Trader273 stumbled uppon. - If you were to work more on the code, and figure out how to solve the problem, please let me know Trader273!
Toyed around with it today, but didnt get the results that it should have produced. I simply make took the condition for a double top, the way it was shown in the code in this thread, and told OEC to put a dot whenever that was true. It didnt put the dots correctly at all, so not sure what to make of it. I could have sworn when I had it "working" yesterday it was correct. If this is the type of stuff you want I would go two routes: 1) Get tradestation or multicharts, and do the coding there. A lot of free scripts are out there and its relatively easy to learn. 2) Learn C#, as that is the native coding language in OEC and other programs. Don't know how well that could be self taught, but I'm sure someone has done it before. I love OEC as I don't use any custom programming stuff. Just something I somewhat enjoyed toying with every now and then.