NexusFi: Find Your Edge


Home Menu

 





Cycle progression?


Discussion in NinjaTrader

Updated
    1. trending_up 1,639 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Cycle progression?

  #1 (permalink)
 Leo123 
Pitea, BD, Sweden
 
Experience: Beginner
Platform: Ninjatrader
Trading: ES
Posts: 34 since Nov 2011
Thanks Given: 1
Thanks Received: 5

Is there anyone who can code this Metastock formula to Ninja Trader?

Sum(If(C>Ref(C,-1),1,0),5)<Sum(If(C<Ref(C,-1),1,0),5)

Sum(If(C>Ref(C,-1),1,0),5)>Sum(If(C<Ref(C,-1),1,0),5)


Someone explained:

1. If(C>Ref(C,-1),1,0) - If current close is greater than previous close then 1 else zero.
2. Sum of 1 for last 5 periods (i.e. sum of either 1 or 0 from point 1 result)
3. If(C<Ref(C,-1),1,0) - If current close is less than previous close then 1 else zero
4. Sum of 3 for last 5 periods (i.e. sum of either 1 or 0 from point 3 result)
Then
check if 2 < 4 or 2 > 4

Thanks

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
 
  #3 (permalink)
 TimeTrade 
Erfurt Germany
 
Experience: Master
Platform: rtMagic, NinjaTrader
Broker: AMP/CQG, IAB
Trading: ES, 6E, FDAX, FGBL
Posts: 338 since Aug 2011
Thanks Given: 54
Thanks Received: 461



Leo123 View Post
Is there anyone who can code this Metastock formula to Ninja Trader?

Sum(If(C>Ref(C,-1),1,0),5)<Sum(If(C<Ref(C,-1),1,0),5)

Sum(If(C>Ref(C,-1),1,0),5)>Sum(If(C<Ref(C,-1),1,0),5)


Someone explained:

1. If(C>Ref(C,-1),1,0) - If current close is greater than previous close then 1 else zero.
2. Sum of 1 for last 5 periods (i.e. sum of either 1 or 0 from point 1 result)
3. If(C<Ref(C,-1),1,0) - If current close is less than previous close then 1 else zero
4. Sum of 3 for last 5 periods (i.e. sum of either 1 or 0 from point 3 result)
Then
check if 2 < 4 or 2 > 4

Thanks


QUICK&DIRTY... (only write as text, no 100% syntax checked )

variables:
DataSeries dsCmpLower;
DataSeries dsCmpHigher;

initialization:
dsCmpLower=new DataSeries(this);
dsCmpHigher=new DataSeries(this);


onbarupdate:

if(CurrentBar>0)
{
dsCmpLower.Set(Close[0]<Close[1] ? 1:0);
dsCmpHigher.Set(Close[0]>Close[1] ? 1:0);
}
else
{
dsCmpLower.Set(0);
dsCmpHigher.Set(0);
}

if(CurrentBar>5)
{
if(SUM(dsCmpLower,5)[0] > SUM(dsCmpHigher,5)[0])
{
// ...code...
}
}

Reply With Quote
Thanked by:
  #4 (permalink)
 Leo123 
Pitea, BD, Sweden
 
Experience: Beginner
Platform: Ninjatrader
Trading: ES
Posts: 34 since Nov 2011
Thanks Given: 1
Thanks Received: 5


TimeTrade View Post
QUICK&DIRTY... (only write as text, no 100% syntax checked )

variables:
DataSeries dsCmpLower;
DataSeries dsCmpHigher;

initialization:
dsCmpLower=new DataSeries(this);
dsCmpHigher=new DataSeries(this);


onbarupdate:

if(CurrentBar>0)
{
dsCmpLower.Set(Close[0]<Close[1] ? 1:0);
dsCmpHigher.Set(Close[0]>Close[1] ? 1:0);
}
else
{
dsCmpLower.Set(0);
dsCmpHigher.Set(0);
}

if(CurrentBar>5)
{
if(SUM(dsCmpLower,5)[0] > SUM(dsCmpHigher,5)[0])
{
// ...code...
}
}


Thanks you are fast!

But, there are some data errors...

Started this thread Reply With Quote




Last Updated on February 28, 2012


© 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