Zig Zag Strategy (like Joe Ross 1 2 3) is working but it is missing some entries - MultiCharts | futures io social day trading
futures io futures trading


Zig Zag Strategy (like Joe Ross 1 2 3) is working but it is missing some entries
Updated: Views / Replies:178 / 1
Created: by Dvdkite Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Zig Zag Strategy (like Joe Ross 1 2 3) is working but it is missing some entries

  #1 (permalink)
Trieste Italy
 
 
Posts: 133 since Feb 2018
Thanks: 122 given, 15 received

Zig Zag Strategy (like Joe Ross 1 2 3) is working but it is missing some entries

Hello everyone,

I'm trying (using the a mix of the zig zag code posted here at FIO and the one provided from multicharts) to code a strategy that uses the zig zag values to perform trades based on the Joe Ross 123 concept.

Example: If you have 3 points p1(first, swing low), p2(second, swing high) and p3(third, swing low then if p3 > p1 and p2 is bigger of both then I want to go long when the price break the p2 value so long at p2 +1 with fixed TP and SL

So I coded the strategy and it often works but it is missing some entries and I cannot understand WHY. Do you have any idea?
The following strategy is coded for the DAX future but it should work on eerything (just check the TP and SL).

 
Code

[IntrabarOrderGeneration = True];

inputs:
 // TS inputs
	
	TargetPoints(10),
	stopPoints(20),
	RR(0),

	// end TS input

	Price( Close ), 
	RetraceType( 1 ), // 1 points , 2 percent
	RetracePct( 0 ),
	RetracePnts( 12 ), 
	LineColor( Yellow ), 
	LineWidth( 1 ),
	ZigZagLineColorDN( yellow ),
	ZigZagLineColorUP( cyan ),
	
	Time_MorningStart_at ( 0800 ),
	Time_MorningStop_at ( 1930 ), // set this higher if you do not need 2 window of the session but just once
	Time_AfternoonStart_at ( 1530 ),
	Time_AfternoonStop_at ( 1730),
	Time_CLOSE_SESSION (2120), // close every open contract at this time
	
	VertOffset1 ( 8 ); // offset for display zigzag swings

variables: 
	NewSwingPrice( 0 ), // SwingHigh/Low zig
	SwingPrice( Price ),
	ZigZagCount(0),                                         
	SwingDate( Date ),                                         
	SwingTime( Time ), 
	PeakTextRef(0), // testo per plottare valore swing
       PeakStr(""),
       ShowEnterAt(0),
  
       isTheRightTime (false),
       canEntry(false), 
       printDebug (true), 
                               
	TLDir( 0 ),                                                         
	var5( 1 + RetracePct * .01 ), // percent retrace up
	var6( 1 - RetracePct * .01 ), // percent retrace down
       RetracePriceLevel(0), // retracement value for ptns and %
	SaveSwing( false ), 
	AddTL( false ), 
	UpdateTL( false ), 
	var10( 0 ),
	
	//----------------
	
	intrabarpersist zigEnabled (false),
	intrabarpersist canPrint (false),
	//---------------
	
	z1(0),
	z2(0),
	z3(0),
	
	X(0),
	Y(0),
	Z(0);

arrays:
	ZigZagArray[10,4](0); // Save here the latest swings
                                                                               

//Time frame of the day where entries are allowed
isTheRightTime = ( time >= Time_MorningStart_at and time <= Time_MorningStop_at) or ( time >= Time_AfternoonStart_at and time <= Time_AfternoonStop_at);

//Selezione caso rintracciamento percentuale o a punti
Switch(TLDir)
	Begin
		Case <= 0:
			Switch(RetraceType)
				Begin
					Case 1: RetracePriceLevel=SwingPrice+RetracePnts;
					Case 2: RetracePriceLevel=SwingPrice*var5;
				End;					
		Case >= 0:
			Switch(RetraceType)
				Begin
					Case 1: RetracePriceLevel=SwingPrice-RetracePnts;
					Case 2: RetracePriceLevel=SwingPrice*var6;				
	                     End;

      End;
 
NewSwingPrice = SwingHigh( 1, Close, 1, 2 ) ; // Picco UP, se al posto di Price metto H usa i massimi altrimenti i close per i vertici
if NewSwingPrice <> -1 then 
	begin
		condition1 = TLDir <= 0 and NewSwingPrice>= RetracePriceLevel ; // var1 * var5 rappresenta RetracePriceLevel
		if condition1 then	// mi preparo ad aggiungere una trend line UP		                            
		begin
			SaveSwing= true ;
			AddTL= true ;
			TLDir= 1 ;
			//Alert("Swing Up");

			end 
		else 
		begin  // preparo un upgrade alla trend line UP precedente	                  
			condition1 = TLDir= 1 and NewSwingPrice>= SwingPrice;
			if condition1 then 
				                                
			begin
				SaveSwing= true ;
				UpdateTL = true ;
				//Alert("Swing Up");

			end ;
		end;
	end 
else 
	begin
	NewSwingPrice= SwingLow( 1, Price, 1, 2 ) ;  // Picco DOWN
	if NewSwingPrice<> -1 then 
		begin
			condition1 = TLDir>= 0 and NewSwingPrice<= RetracePriceLevel ;
			if condition1 then 
				                            
				begin
				SaveSwing= true ;
				AddTL= true ;
				TLDir= -1 ;
				//Alert("Swing Down"); 

				end 
			else 
			begin // preparo un upgrade alla trend line DOWN precedente
				condition1 = TLDir= -1 and NewSwingPrice<= SwingPrice;
				if condition1 then 				                                
				begin
				SaveSwing= true;
				UpdateTL= true ;
				//Alert("Swing Down");

				end ;
			end;
		end ;
	end ;

if SaveSwing then 
	                                      
	begin
	SwingPrice= NewSwingPrice;
	SwingDate= Date[1] ;
	SwingTime= Time[1] ;
	SaveSwing= false ;
	canEntry= true; // variabile per evitare entrate multiple, cos in teoria puo' farlo solo una volta dopo ogni swing confermato
	end ;

if AddTL then 
	                              
	begin
	var10 = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], 
	 SwingPrice[1] ) ;
	TL_SetExtLeft( var10, false ) ;
	TL_SetExtRight( var10, false ) ;
	TL_SetSize( var10, LineWidth ) ;
	PeakTextRef=Text_New(Date,Time,Close," "); //  Inizializzo

	
	If(TLDir=-1)Then TL_SetColor(var10,ZigZagLineColorDN)
	Else TL_SetColor(var10,ZigZagLineColorUp);
	
	ZigZagCount=ZigZagCount+1;
	
	//Scalo di un posto indietro i valori degli swing prima di inserire il nuovo al posto 0
	For Y=9 DownTo 0
		Begin 
		For Z=1 to 4
			Begin
			ZigZagArray[Y+1,Z]=ZigZagArray[Y,Z];
			End;
		End;
	//Inserisco i nuovi dati dello swing nella prima riga ovvero la zero
	ZigZagArray[0,1]=SwingPrice; {Current Swing Price}
	ZigZagArray[0,2]=BarNumber; {BarNumber}
	ZigZagArray[0,3]=TimetoMinutes(SwingTime); {SwingTime Variable}
	ZigZagArray[0,4]=ZigZagCount; {Current ZZ Count}
	
	//print(" zigzag " , NumToStr(ZigZagArray[1,1],2), "  ZZ number: " , NumToStr(ZigZagCount,0));
	//Plot valore swing
	PeakStr=NumToStr(SwingPrice,2);
	Text_SetString(PeakTextRef,PeakStr);
	Text_SetStyle(PeakTextRef,2,2);
	If(TLDir=-1)Then Text_SetColor(PeakTextRef,ZigZagLineColorDN)
	Else Text_SetColor(PeakTextRef,ZigZagLineColorUp);
	If(TLDir=-1)Then Text_SetLocation(PeakTextRef,SwingDate,SwingTime,SwingPrice - VertOffset1)
	else Text_SetLocation(PeakTextRef,SwingDate,SwingTime,SwingPrice + VertOffset1);
		
	AddTL = false ;
	canEntry = false;
	end 
else if UpdateTL then 
	                                     
	begin
	TL_SetEnd( var10, SwingDate, SwingTime, SwingPrice) ;
	
	ZigZagArray[0,1]=SwingPrice; {Current Swing Price}
	ZigZagArray[0,2]=BarNumber; {BarNumber}
	ZigZagArray[0,3]=TimetoMinutes(SwingTime); {SwingTime Variable}

	//Plot valore swing
	PeakStr=NumToStr(SwingPrice,2);
	Text_SetString(PeakTextRef,PeakStr);
	Text_SetStyle(PeakTextRef,2,2);
	If(TLDir=-1)Then Text_SetColor(PeakTextRef,ZigZagLineColorDN)
	Else Text_SetColor(PeakTextRef,ZigZagLineColorUp);
	If(TLDir=-1)Then Text_SetLocation(PeakTextRef,SwingDate,SwingTime,SwingPrice - VertOffset1)
	else Text_SetLocation(PeakTextRef,SwingDate,SwingTime,SwingPrice + VertOffset1);
	
	UpdateTL= false ;
	end ;


CommentaryCL ("PeakStr: ",PeakStr,NewLine);

//--------------------------------- STRATEGY START HERE --------------------------------------- 

// lo swing attuale (quello che sarebbe z0) e' la variabile SwingPrice
z1 = ZigZagArray[1,1];
z2 = ZigZagArray[2,1];
z3 = ZigZagArray[3,1];
	

//print("il valore delllo zig 1,1 alle ore ", time," e' ", NumToStr(z1,2), NewLine, NewLine, "mentre lo zig 2,1 e' ", NumToStr(z2,0), NewLine, NewLine,"mentre lo zig 3,1 e' ", NumToStr(z3,0));

if marketposition = 0 then // and isTheRightTime then
	begin
		//if z2 < z3 and z2 < z1 and z1 < z3 and // condizione massimi decrescenti
		if z1 < z2 and z1 < SwingPrice and SwingPrice < z2 and // condizione massimi decrescenti
		   L < z1 // mi assicuro che una volta passato z1 ovvero il punto 2 l'ordine rimanga a mercato
	              then begin
	                      //if printDebug and barstatus = 2 then print(NewLine," Punto 3 = SwingPrice alle ore ", time," e' ", NumToStr(swingPrice,2), NewLine, NewLine, " punto 2 = z[1,1] e' ",
				 //NumToStr(z1,2), NewLine, NewLine,"punto 1 = z[2,1] e' ", NumToStr(z2,2));
				
			       //if printDebug then print(NewLine," --Data ",FormatDate("dd-MM-yyyy", ELDateToDateTime(Date))," --Time ",NumToStr(time,0),"-------> SHORT at ", NumToStr(entryprice,2),NewLine);
				  //ShowEnterAt = Text_New(Date,Time,Close," Zig Short "); 
				  //Text_SetLocation(ShowEnterAt ,barnumber,time,H + VertOffset1);
				
			       sellshort ("Short Entry") 1 contract next bar at z1 - 1 * ticksize + RR * ticksize limit;
				//canEntry = false;
			end; 
			
		//if z2 > z3 and z2 > z1 and z1 > z3 and // condizione minimi crescenti
		if z1 > z2 and z1 > SwingPrice and SwingPrice > z2 and // condizione minimi crescenti
			H > z1 // mi assicuro che una volta passato z1 ovvero il punto 2 l'ordine rimanga a mercato
			
		       then begin
		       		
		             //if printDebug and barstatus = 2 then print(NewLine," Punto 3 = SwingPrice alle ore ", time," e' ", NumToStr(swingPrice,2), NewLine, NewLine, " punto 2 = z[1,1] e' ",
				// NumToStr(z1,2), NewLine, NewLine,"punto 1 = z[2,1] e' ", NumToStr(z2,2));
				//if printDebug then print(NewLine," --Data ",FormatDate("dd-MM-yyyy", ELDateToDateTime(Date))," --Time ",NumToStr(time,0),"-------> LONG at ", NumToStr(entryprice,2),NewLine);
				ShowEnterAt = Text_New(Date,Time,Close," Zig Long "); 
				  Text_SetLocation(ShowEnterAt ,date,time,L - VertOffset1);
				
				 

				buy ("Long Entry") 1 contract next bar at z1 + 1 * ticksize - RR  * ticksize limit;// 
				canPrint = true;


			end; 

	end;

setstoploss( stopPoints * bigpointvalue);
setprofittarget( targetPoints * bigpointvalue );
 	
	
if marketposition = 1 then begin

	//Sell("TargetLong") 1 contract Next Bar at (entryprice + TargetPoints) limit;
	//Sell("StopLong") 1 contract Next Bar at (entryprice - stopPoints) stop;
	if printDebug and canPrint and barstatus = 2 then print(NewLine," Punto 3 = SwingPrice alle ore ", time," e' ", NumToStr(swingPrice,2), NewLine, NewLine, " punto 2 = z[1,1] e' ",
				 NumToStr(z1,2), NewLine, NewLine,"punto 1 = z[2,1] e' ", NumToStr(z2,2));
				
	if time = Time_CLOSE_SESSION then sell("LE CLOSE SESSION") 1 contract next bar at market;
	canprint = false;

end;
	
if marketposition = -1 then begin

	//buytocover("TargetShort") 1 contract Next  Bar at (entryprice - TargetPoints) limit;
	//buytocover("StopShort") 1 contract Next Bar at (entryprice + stopPoints) stop;
	
	if time = Time_CLOSE_SESSION then buytocover("SE CLOSE SESSION") 1 contract next bar at market;

end;

Now just to give you an idea of MISSED ENTRY this is an example: (it should have gone long at 11940 but it didn't):
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).



Any idea is appreciated

Thanks

Reply With Quote
 
  #2 (permalink)
Trieste Italy
 
 
Posts: 133 since Feb 2018
Thanks: 122 given, 15 received

Anyone had a chance to try the code?

I'm still working on it and I'm also facing problems in order to avoid 2 consecutive entries based on the same conditions....
I'm struggling to find a way to allow only ONE order when conditions are met...

Reply With Quote

Reply



futures io > > > > Zig Zag Strategy (like Joe Ross 1 2 3) is working but it is missing some entries

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$1,000 in Amazon Gift Cards being given away right now from GFF Brokers

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Show us your trading desks and win over $5,000 in prizes w/Jigsaw Trading

August
 

Webinar: Suri Duddella (TBA)

Elite only
 

Webinar: Richard Bailey (TBA)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
help adding time to zig zag indicator... YertleTurtle ThinkOrSwim Programming 1 January 25th, 2015 02:48 PM
how to I get zig-zag indicator of Ninja 7 to display (or export) price info? aquarian1 NinjaTrader 5 December 21st, 2011 05:26 PM
On zig-zag indicator, can the #'s show on top of fib lines? Todd NinjaTrader Programming 7 July 21st, 2010 09:33 AM
Zig Zag UTC Swing error Mauro_60 NinjaTrader 12 November 10th, 2009 06:46 AM
Book Tip: Joe Ross - Trading the Ross Hook astra68 The Elite Circle 1 September 25th, 2009 03:36 PM


All times are GMT -4. The time now is 05:51 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts