Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Darvas boxes Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Hushai
Posted : Wednesday, September 17, 2008 1:16:31 AM
Registered User
Joined: 9/12/2008
Posts: 55

Would it be possible to tranlate this into a block?
IF NOT - would it be possible to translate to VB.net?

Thank you.


//////////begin/////////

box1=0;
box2=0;

procedure fillDarvas(start,end,swap,top, bottom )
{
   for ( j = start; j < end; j++)
   {
       if( box1[j] = swap)
box1[j]= top ;
else
box1[j]= bottom;

       if(box2[j] = swap)
box2[j]= bottom ;
else
box2[j]= top;
   }
}

BoxArr1 = 0;
BoxArr2 = 0;
StateArray = 0;
DBuy = 0;
DSell = 0;
TopArray = 0;
BotArray = 0;
tick=0;

BoxTop = High[0];
BoxBot = Low[0];
swap=0;
state = 0;
BoxStart = 0;

for (i=0; i<BarCount; i++)
{
if (state==5)
{
  TopArray=BoxTop;
  BotArray=BoxBot;
  if (Low<(BoxBot*(1-tick/100)) || High>(BoxTop*(1+tick/100)))
  {
fillDarvas(BoxStart,i,swap,BoxTop,BoxBot);

  state = 1;
  swap =  !swap;
  BoxTop = High;
  BoxStart = i;
  }
}
else
{
  if (High<BoxTop)
  {
      if ((state<3) || (Low>BoxBot))
      {
   state++;
   }
      else
   {
      state=3;
   }
      if (state==3)
      BoxBot=Low;
  }
  else
  {
      state=1;
      BoxTop=High;
  }
}
StateArray = state;
}

fillDarvas(BoxStart,BarCount,swap,BoxTop,BoxBot);

Plot(C,"",1,64);
//Plot( box1, "" , colorRed, styleLine );
//Plot( box2, "" , colorGreen , styleLine );

Plot( box1, "" , colorRed, 512);
Plot( box2, "" , colorGreen , 512);

///////////end///////////////////

Bruce_L
Posted : Wednesday, September 17, 2008 2:49:24 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I don't understand the posted code and cannot translate it into RealCode. I have created a Darvas Box Chart using a description of a state machine for finding Darvas Boxes that I found on the Internet however.

Select Share | Charts.
Type Hushai35635 and select Search.
Select the Hushai35635 Chart.
Select Open.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Hushai
Posted : Wednesday, September 17, 2008 4:23:53 PM
Registered User
Joined: 9/12/2008
Posts: 55
Well that was nice of you.  I will check it as soon as I get a chance.

Thanks much.
Bruce_L
Posted : Wednesday, September 17, 2008 4:24:56 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.