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

RE: [amibroker] No more than 1 trade per day



PureBytes Links

Trading Reference Links

Thomas Z,

Many thanks for your help, that worked fine.

Barry

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Charles Stangor
Sent: Saturday, 1 October 2005 9:32 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] No more than 1 trade per day

 

Hi Thomas.  Yeah, I'm sure you're right.  Thanks.

 

 

chuck

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

From: Thomas Z

Sent: Saturday, October 01, 2005 3:14 AM

Subject: Re: [amibroker] No more than 1 trade per day

 

Hi Chuck,

i see no problem in the code because it compares the difference between the current setup-date and the most recent setup-date.

Regards
 
Thomas
www.tradingbasis.com



Charles Stangor wrote:

I appreciated seeing this code, which is very relevant to an issue I've been trying to solve. I've posted a couple times on this topic in the past days.  It also relates to the topic of loops which has been discussed recently.  Here's the proposed code:

Setup = your buy condition;
Tradedate =
ValueWhen(setup,DateNum(),1);
LastTradedate =
Ref(Tradedate,-1);
Otpd = Tradedate > Lasttradedate;
//only one trade per day

Buy = Otpd AND Setup;

However, there’s a general problem with this code, I believe.  It probably works fine most of the time, but is not really doing what you want it to.  The problem is that you are trying to base a trade on a past result.  But that past result is determined by the current trade.

The idea is

1.       Set up your temporary trade conditions (setup)

2.         Check to see if those temporary trade conditions were true in the past

3.         Trade on the basis of both 1 and 2

The problem is that step 1 should really be checking to see if the actual trade (step 3) occurred in the past.  However the current code only checks whether step 1 occurred in the past.  In some cases this could cause a problem because step 1 may indicate that a trade has been taken when in fact it has not.  I am not sure I have this right, and if I am right I am not sure that this can be solved without using loops.

Your thoughts appreciated....

Chuck

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

From: Thomas Z

Sent: Friday, September 30, 2005 8:08 AM

Subject: Re: [amibroker] No more than 1 trade per day

 

Hello Barry,

i also trade forex and have written such code a few months ago.
I have searched my files right now and have found the following code.
Check it out, i have not tested it right now.

Setup = your buy condition;
Tradedate =
ValueWhen(setup,DateNum(),1);
LastTradedate =
Ref(Tradedate,-1);
Otpd = Tradedate > Lasttradedate;
//only one trade per day

Buy =  Setup;


Regards
 
Thomas
www.tradingbasis.com
    



Barry Seeger wrote:

How can I require that there be no more than 1 trade per day?

I’m trading forex, on one currency, and I want to require that if there has been a Buy or Sell today, then take no more trades today.

Something like: Buy = conditions AND DayofWeek() > or < DayofWeek() for last Buy or Sell, but I don’t know how to write it.

The “or <” would allow for Mondays.

Thanks for your help.




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 other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS