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

RE: [amibroker] Please help on issues with buy and sell on the same day


  • Date: Tue, 29 Dec 2009 09:26:47 +1100
  • From: "Neil Wrightson" <neilw@xxxxxxxxxx>
  • Subject: RE: [amibroker] Please help on issues with buy and sell on the same day

PureBytes Links

Trading Reference Links



Hi,
 
I quickly found that I could not use the basic style code you have below.
First I tested for the entry condition, if true, then I would create my own BuyFlag "EntSigSwt" as well as a flag to say that I'm in the trade "TslBarStp".
 
As an Example

// Buy processing

if(EntSigSwt[i] AND ! TslBarStp[i])

    {

        BuySigInd[i] = 1 ;

        if(i < BarCount -1)

            {

                Buy[i +1] = 1 ;

                BuyPrice[i +1] = O[i +1] ;

                IslBarStp[i +1] = L[i] ;

                 TslBarStp[i +1] = C[i] - TslBarGap[i] ;

            }

    }

Regards,

Neil Wrightson.



From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of yimapo
Sent: Monday, 28 December 2009 10:58 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Please help on issues with buy and sell on the same day

 

I'm playing with a long-only scalping strategy. The idea is to buy at today's closing price and sell on the next day if next day's price reaches profit target. Following is the simple script I wrote:

Buy = 1;
BuyPrice = Ref(C,-1);
Sell = H > Ref(C,-1) + 0.25;
SellPrice = Ref(C,-1) + 0.25;

Hence, there are both buy and sell on the same day but the buy actually sell occurs before buy because buy always occurs at market close. However, the back test results show that Amibroker reversed the order of buy and sell, i.e., instead of selling the shares purchased at yesterday's close, shares which haven't been bought are sold. How can I tell which trade occurs first on the same day? Thanks.



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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





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

__,_._,___