[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Entry Time Delay



PureBytes Links

Trading Reference Links

Ok, let me try this another route;
 
Is there a way to count trades completed?  So I could have a variable called say "TradeCount" and when it was equal to "0" my standard buy and short code is used. After the first trade is completed (i.e. when TradeCount == 1) I use the Buy and Short code below is used.
 
Any suggestions.  Spent most of the weekend on this with no luck.
 
I really could use the help,
 
Fred
 
 
 
----- Original Message -----
Sent: Friday, June 29, 2007 8:22 AM
Subject: Re: [amibroker] Entry Time Delay

Herman,
 
Actually I think you meant to type:
 
Buy = Buy AND BarsSince(Sell)>=5 AND BarsSince(Cover) >=5;
 
similarily,
 
Short = Short AND BarsSince(Sell)>=5 AND BarsSince(Cover) >=5;
 
In my head this should only allow a "Buy" (or "Short") 5 bars after the last trade exit.
 
Now the problem with this approach is that there cannot be a Sell Or Cover without a trade (A Buy or Short)first being put on by definition.  You cannot end a trade without first putting on a trade.  In the above, you cannot put on a trade until 5 days after a Sell or Cover.  So when you run this code, no trades are initiated.
 
If there was a way of initiating the code with a Sell and Cover signal on Bar "0" then I'd assume that on Bar 5 that the conditions in the Buy and Short code at the top would be satisfied.  I don't know how to intiate the code so that it starts with a sell and cover signal.
 
I've tried:  Sell = Cover = 1
 
I've tried in my if loop,
    If (i == 0)
    {
        sell(i) = 1;
        cover(i) = 1;
    }
 
Neither has worked.
 
Am I missing something in your logic?
 
thanks,
 
Fred
 
----- Original Message -----
From: Herman
Sent: Friday, June 29, 2007 5:31 AM
Subject: Re: [amibroker] Entry Time Delay


Your system here...


Sell = Sell AND BarsSince(Sell) >= 5;


herman


Thursday, June 28, 2007, 9:36:11 PM, you wrote:


>

Ok now really frustrated.  Nothing seems to be working.

 

Here's what I want to do:

Wait 5 bars after a sell or cover before buying or shorting again.  You would think this was simple but as you can see below it is causing me some trouble.  Any help would be appreciated.

 

thx,

 

Fred

 

----- Original Message ----- 

From: Ed Middleton 

To: amibroker@xxxxxxxxxps.com 

Sent: Thursday, June 28, 2007 2:37 PM

Subject: Re: [amibroker] Entry Time Delay


Ok, I've found the problem.  BarsSince(Sell) and BarsSince(Cover) never = anything because there is not Sells or Covers to get a value from and thus no buys or shorts.  Somehow I need to be able to allow the first buy or Short to occur then everything will be ok.

 

Any suggestions?

 

thx,

 

----- Original Message ----- 

From: Ed Middleton 

To: amibroker@xxxxxxxxxps.com 

Sent: Thursday, June 28, 2007 11:48 AM

Subject: Re: [amibroker] Entry Time Delay


Also tried:

BarsSinceExit = Min(BarsSince(Sell),BarsSince(Cover));

Added to Buy and Short lines:

AND (BarsSinceExit > 0);

This should have gotten me in on the next 5 minute bar.  No luck with this procedure either.  I'm missing something in my programming logic.

 

 

----- Original Message ----- 

From: jjj_98 

To: amibroker@xxxxxxxxxps.com 

Sent: Thursday, June 28, 2007 11:04 AM

Subject: [amibroker] Entry Time Delay


After exiting a trade I want to wait 5 minutes before re-entering a 

trade so here's what code I've tried but it does not seem to be 

making a difference in the next entry. Do you see any problems?


//Initialize last trade exit times


LastSellTime = LastCoverTime = 000000;


// Calculates Amount of time since last exit


TimeSinceLastTrade = Min((TimeNum() - LastSellTime),(TimeNum() - 

LastCoverTime));


// I added this to my BUY and SHORT instructions so that the time to 

re-enter the next trade must be greater than 5 minutes.


AND (TimeSinceLastTrade > 000500);


//In my logic added the following to get the time of the Last Sell 

and Last Cover


if(Sell[i] == 1)

{

LastSellTime = TimeNum();

}


if(Cover[i] == 1)

{

LastCoverTime = TimeNum();

}



Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. 


Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. 

 

  


Boardwalk for $500? In 2007? Ha! 

Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.


Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get online.

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___


Need a vacation? Get great deals to amazing places on Yahoo! Travel.