NexusFi: Find Your Edge


Home Menu

 





Cross Abv/Blw - Double arrow question


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Al2010 with 8 posts (0 thanks)
    2. looks_two gulabv with 4 posts (4 thanks)
    3. looks_3 sam028 with 2 posts (2 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 5,542 views
    2. thumb_up 7 thanks given
    3. group 4 followers
    1. forum 15 posts
    2. attach_file 8 attachments




 
Search this Thread

Cross Abv/Blw - Double arrow question

  #1 (permalink)
Al2010
 
Posts: 50 since Oct 2010
Thanks Given: 36
Thanks Received: 10

Hello,
I'm new to C#-Ninja programming and cannot figure out the problem. Is there a way to display only one arrow per cross please? Please see attached screen shot. Is there error in the code(attached)?
I'd appreciate if anyone would be willing to help. This should be simple problem for any experienced programmer. And I hope it is not too much to ask to share your knowledge resolving this simple matter.
Thank you very much.

Attached Thumbnails
Click image for larger version

Name:	CrossAB_DblArrow.jpg
Views:	240
Size:	146.2 KB
ID:	27916  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Exit Strategy
NinjaTrader
REcommedations for programming help
Sierra Chart
Increase in trading performance by 75%
The Elite Circle
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


you could add a flag inside red arrow condition then check for it before moving on to orange arrow.

Reply With Quote
Thanked by:
  #4 (permalink)
Al2010
 
Posts: 50 since Oct 2010
Thanks Given: 36
Thanks Received: 10


cory View Post
you could add a flag inside red arrow condition then check for it before moving on to orange arrow.

Thank you. I tried flag but it does not work. I do not really know how to do this correctly. If you or anyone can share a small example then please do so.
I tried the following:

if (K[0] <= 80 && K[0] >= 70)
{
if (CrossBelow(Stochastics(PeriodD, periodK, smooth).K, 80, 1))
RedFlag = true;
DrawArrows(2, 9); // Red arrow
}
else if (K[0] <= 70 && K[0] >= 60)
{
if (CrossBelow(Stochastics(PeriodD, periodK, smooth).K, 70, 1))

if RedFlag == false
DrawArrows(2, 4); // Orange arrow
OrangeFlag = true;
}
RedFlag = false;
OrangeFlag = false;


Thank you in any case.

Reply With Quote
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

How about using K[1] ?

 
Code
                            
if (K[0] <= 80 && K[0] >= 70){
  if (
CrossBelow(Stochastics(PeriodDperiodKsmooth).K801))
    
DrawArrows(29);  // Red arrow}
  
else 
    if (
K[0] <= 70 && K[0] >= 60) {
      if ( (
CrossBelow(Stochastics(PeriodDperiodKsmooth).K701))  && (K[1] < 70 || K[1] >80))
        
DrawArrows(24); // Orange arrow


Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #6 (permalink)
Al2010
 
Posts: 50 since Oct 2010
Thanks Given: 36
Thanks Received: 10


sam028 View Post
How about using K[1] ?

 
Code
                            
if (K[0] <= 80 && K[0] >= 70){
  if (
CrossBelow(Stochastics(PeriodDperiodKsmooth).K801))
    
DrawArrows(29);  // Red arrow}
  
else 
    if (
K[0] <= 70 && K[0] >= 60) {
      if ( (
CrossBelow(Stochastics(PeriodDperiodKsmooth).K701))  && (K[1] < 70 || K[1] >80))
        
DrawArrows(24); // Orange arrow




Thank you very much!

Reply With Quote
  #7 (permalink)
Al2010
 
Posts: 50 since Oct 2010
Thanks Given: 36
Thanks Received: 10


sam028 View Post
How about using K[1] ?

 
Code
                            
if (K[0] <= 80 && K[0] >= 70){
  if (
CrossBelow(Stochastics(PeriodDperiodKsmooth).K801))
    
DrawArrows(29);  // Red arrow}
  
else 
    if (
K[0] <= 70 && K[0] >= 60) {
      if ( (
CrossBelow(Stochastics(PeriodDperiodKsmooth).K701))  && (K[1] < 70 || K[1] >80))
        
DrawArrows(24); // Orange arrow



Almost works but still getting double arrows at some places and no arrows at other places where there used to be an arrow.
Thank you.

Reply With Quote
  #8 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

Try to put some print (with Print() ) some values before each DrawArrows(), it will help you to find what's wrong in your logic.
With only a small part of the indicator, it's hard for us to find what could be wrong.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #9 (permalink)
Al2010
 
Posts: 50 since Oct 2010
Thanks Given: 36
Thanks Received: 10


sam028 View Post
Try to put some print (with Print() ) some values before each DrawArrows(), it will help you to find what's wrong in your logic.
With only a small part of the indicator, it's hard for us to find what could be wrong.


Hello Sam,
First, I truly appreciate your help.
If you have time and will please see attached compiled .cs file. I'm using 6E 300 volume chart for my testing. There are many double arrows with the approach you have suggested. It is impossible for me to figure out what is wrong and how to fix it. If you can please help. If not then I still truly thank you very much.

Attached Thumbnails
Click image for larger version

Name:	DblArrow01.jpg
Views:	218
Size:	248.2 KB
ID:	27979   Click image for larger version

Name:	TestCase_NoArrow.jpg
Views:	187
Size:	216.0 KB
ID:	27980  
Attached Files
Elite Membership required to download: MyStochArrow.cs
Reply With Quote
  #10 (permalink)
 
gulabv's Avatar
 gulabv 
Dallas, TX
 
Experience: Beginner
Platform: Ninjatrader
Broker: Zen-Fire
Trading: ZN, 6E
Posts: 286 since May 2010
Thanks Given: 161
Thanks Received: 169


Do you really need CalculateOnBarClose = false ?

The way this indicator is coded currently you could get multiple draw object painted on the chart for each 300 volume bar as the COBC = false setting analyzes your code on each incoming tick. I would think you want to set COBC = true so that your criteria is checked each time a bar completes. Not sure what you are trying to do so I can only speculate this might alleviate the problems you are seeing...

Hope this helps,
gulabv

Reply With Quote
Thanked by:




Last Updated on January 9, 2011


© 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