NexusFi: Find Your Edge


Home Menu

 





Renko ACSIL?


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one Amnesia with 9 posts (0 thanks)
    2. looks_two aslan with 4 posts (2 thanks)
    3. looks_3 vegasfoster with 2 posts (1 thanks)
    4. looks_4 cory with 1 posts (0 thanks)
    1. trending_up 4,898 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 16 posts
    2. attach_file 7 attachments




 
Search this Thread

Renko ACSIL?

  #11 (permalink)
Amnesia
Vienna Austria
 
Posts: 116 since Mar 2012
Thanks Given: 16
Thanks Received: 67


aslan View Post
1. The index check is not technically needed, because SC will guard against accessing bad array indexes. However, it is good practice to not access values that do not exist, especially if they affect your overall logic moving forward (i.e. you do not want to generate bogus data that then feeds forward).

2. Vegas can explain his intent, but he is basically back propagating the values for the next calculation.

3. The assignment of sc.DataStartIndex really belongs in the SetDefaults block. (minor)

4. While I said that drawings would not slow you down, this code is a good example where I would not use them just because the code is so simple, and drawings would add some complexity. Only add them if you need to.

Okay just a small touchup on 2)

Once the for loop is done it basically repeats the entire process starting again at the top doing calculations but this time for the next bar correct?
Because since this is on autoloop it will cycle through every single candle until it has hit the array end. So it will perform the bool calcualtion for index 5 then it will do it for index 6 then 7 then 8 etc etc correct?

So why would i want to propagate values backwards when the calculation is going to be done anyways?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Request for MACD with option to use different MAs for fa …
NinjaTrader
ZombieSqueeze
Platforms and Indicators
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
48 thanks
NexusFi site changelog and issues/problem reporting
47 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #12 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 351
Thanks Received: 1,126


Amnesia View Post
Okay just a small touchup on 2)

Once the for loop is done it basically repeats the entire process starting again at the top doing calculations but this time for the next bar correct?
Because since this is on autoloop it will cycle through every single candle until it has hit the array end. So it will perform the bool calcualtion for index 5 then it will do it for index 6 then 7 then 8 etc etc correct?

So why would i want to propagate values backwards when the calculation is going to be done anyways?

No, you only get called for each historical bar once when you start up (i.e. you will be called once for each bar 0, 1, 2, ..., last bar). You then get called for each update to the current bar (i.e. 138, 138, 138, 138, ... 139, ....). Again, I do not know the intent or that loop, but it is getting copied back one for the calc on next bar, perhaps the second copy is for visual effect?

Reply With Quote
The following user says Thank You to aslan for this post:
  #13 (permalink)
Amnesia
Vienna Austria
 
Posts: 116 since Mar 2012
Thanks Given: 16
Thanks Received: 67



aslan View Post
No, you only get called for each historical bar once when you start up (i.e. you will be called once for each bar 0, 1, 2, ..., last bar). You then get called for each update to the current bar (i.e. 138, 138, 138, 138, ... 139, ....). Again, I do not know the intent or that loop, but it is getting copied back one for the calc on next bar, perhaps the second copy is for visual effect?

@aslan

 
Code
sc.DataStartIndex = 5;
	if (sc.Index > 5)
	
	{
		
	bool Long = sc.Close[sc.Index-3] < sc.Close[sc.Index-4] && 
				sc.Close[sc.Index-2] > sc.Close[sc.Index-3] && 
				sc.Close[sc.Index-1] > sc.Close[sc.Index-2] && 
				sc.Close[sc.Index] > sc.Close[sc.Index-1];
	
	
	Plot1[sc.Index] = Long ? sc.Low[sc.Index-2] : Plot1[sc.Index-1]; //Condition parameters
		
	int Index = sc.Index;
	
	for(int i = 1; i<=2; i++)
	{
		Plot2[Index-i] = Plot1[sc.Index];		
	}
	
	}
}
So this part of the code gets called on startup and is run through each bar (first bar to the right up to the last bar on the left) or to put it in code terms from sc.currentindex all the way to the left of the chart to sc.ArraySize-1

And once that is done it is called once for each currentbar update, or in other terms everytime the sc.index/sc.currentindex changes or gets a new value?

Reply With Quote
  #14 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 351
Thanks Received: 1,126


Amnesia View Post

So this part of the code gets called on startup and is run through each bar (first bar to the right up to the last bar on the left) or to put it in code terms from sc.currentindex all the way to the left of the chart to sc.ArraySize-1

And once that is done it is called once for each currentbar update, or in other terms everytime the sc.index/sc.currentindex changes or gets a new value?

Yes, at startup it would be called once with sc.Index set to 0 .. sc.ArraySize-1 (in that order). Then it would only be called with sc.Index set to the current bar index (updates to current bar or a new bar gets started) This is how autoloop works.

Reply With Quote
The following user says Thank You to aslan for this post:
  #15 (permalink)
Amnesia
Vienna Austria
 
Posts: 116 since Mar 2012
Thanks Given: 16
Thanks Received: 67


aslan View Post
Yes, at startup it would be called once with sc.Index set to 0 .. sc.ArraySize-1 (in that order). Then it would only be called with sc.Index set to the current bar index (updates to current bar or a new bar gets started) This is how autoloop works.

This..... This clarified a shitton i cannot thank you enough and kind of clarifies a lot of things

As for the loop, i guess i should just cut it out then since it serves no use for this right now. But i will ask vegas about it.

Reply With Quote
  #16 (permalink)
Amnesia
Vienna Austria
 
Posts: 116 since Mar 2012
Thanks Given: 16
Thanks Received: 67

Sooo...

I have made some modifications to the code, after i finally was able to understand why @vegasfoster was using that for loop (thanks again btw for answering all those pesky pm's)

I decided to play around with the code a bit. So here is basically why vegas was using the for loop:

https://nexusfi.com/attachments/116695d1372201946
https://nexusfi.com/attachments/116696d1372201946

Basically it is necessary to make sure the horizontal line is exactly where i want it to be.

Now i have modified the code to the following and basically made it much simpler:

 
Code
	sc.DataStartIndex = 5;
	if (sc.Index > 5)
	
	{
		
	bool Long = sc.Close[sc.Index-3] < sc.Close[sc.Index-4] && 
				sc.Close[sc.Index-2] > sc.Close[sc.Index-3] && 
				sc.Close[sc.Index-1] > sc.Close[sc.Index-2] && 
				sc.Close[sc.Index] > sc.Close[sc.Index-1];
	
	if (Long == true)
		{ 
		Plot1[sc.Index-2] = sc.Low[sc.Index-2];
		}
		
	
	
	}
}
Basically all it does is for every iteration that is happening during autoloop being on, it checks if the bool value is true, and if it is it draws it at index-2 with the value of sc.low that is located at index-2.

All fine and dandy and working except for this:


The horizontal line is quite short...

So my questions are

1) Any criticism on the code? Weaknesses from a logic perspective?
2) Any idea how to make that horizontal line longer?

EDIT: Yeah nvm i think i see it now, thats pretty much what the ternary operator did... god damnit, im trying to put this into the "Else" part of the If statement, will update my code into here as i work along and figure stuff out, perhaps it may help someone when they are working on developing their custom study

EDIT2:

Yeah got it working

 
Code
	sc.DataStartIndex = 5;
	if (sc.Index > 5)
	{
		
	bool Long = sc.Close[sc.Index-3] < sc.Close[sc.Index-4] && 
				sc.Close[sc.Index-2] > sc.Close[sc.Index-3] && 
				sc.Close[sc.Index-1] > sc.Close[sc.Index-2] && 
				sc.Close[sc.Index] > sc.Close[sc.Index-1];
	
	if (Long == true)
	{ 
		Plot1[sc.Index-2] = sc.Low[sc.Index-2];
	}
	
	else
	{
		Plot1[sc.Index-2] = Plot1[sc.Index-3];
		
	}
	}
}

Attached Thumbnails
Click image for larger version

Name:	plot1.PNG
Views:	348
Size:	35.7 KB
ID:	116695   Click image for larger version

Name:	plot2.PNG
Views:	317
Size:	40.4 KB
ID:	116696  
Reply With Quote
  #17 (permalink)
Amnesia
Vienna Austria
 
Posts: 116 since Mar 2012
Thanks Given: 16
Thanks Received: 67

Minor modifications:

 
Code
sc.DataStartIndex = 5;
	if (sc.Index > 5)
	
	{
		
	bool Long = sc.Close[sc.Index-3] < sc.Close[sc.Index-4] && 
				sc.Close[sc.Index-2] > sc.Close[sc.Index-3] && 
				sc.Close[sc.Index-1] > sc.Close[sc.Index-2] && 
				sc.Close[sc.Index] > sc.Close[sc.Index-1];
	
	if (Long == true)
	{ 
		Plot1[sc.Index-2] = sc.BaseData[SC_RENKO_CLOSE][sc.Index-3]; 
		Plot2[sc.Index-2] = sc.BaseData[SC_RENKO_OPEN][sc.Index-2]; 
	}
	
	else
	{
		Plot1[sc.Index-2] = Plot1[sc.Index-3];
		Plot2[sc.Index-2] = Plot2[sc.Index-3];
		
	}
		
	
	
	}

Reply With Quote





Last Updated on June 25, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts