PureBytes Links
Trading Reference Links
|
If this is all the code there is, it won't work. There's no Buy signal.
Some questions:
1. You are initializing EntryPriceLong and EntryPriceShort, but
EntryPriceLong is reset in the code to the Open and EntryPriceShort is not
used at all. No harm done, but you are not using the BuyPrice you set.
2. I take it you are buying on the Open?
3. You are setting your Targetfigure to the Close of the day on which you
buy and your EntryPriceLong to the Open of the same day then you are testing
to see if you lost money on the day and, if so, you are going exiting you
Buy. This doesn't tell you the 1st profitable trade. It will simply Sell if
you lost money by the close. Further, the Sell signal is generated for the
same day.
I think you need to explain in English what you are trying to do.
FYI: Braces are only required for multiple statements after an IF ()
statement. You way works fine. Here's another way.
if( Open[ i ] > Targetfigure[i] && Targetfigure[i] > 0)
Sell[ i ] = 1;
else Sell[ i ] = 0;
--
Terry
From: "Collectable Images" <telecard@xxxxxxxxxxxxxx>
Reply-To: amibroker@xxxxxxxxxxxxxxx
Date: Sun, 3 Oct 2004 20:12:12 +1000
To: <amibroker@xxxxxxxxxxxxxxx>
Subject: [amibroker] RE:Exit first profitable Trade
Hello guys,
I am trying to get code to find the first profitable open after an entry.
This is what I have so far, can someone check it to see if it works?
EntryPriceLong = BuyPrice;
EntryPriceShort = ShortPrice;
Targetfigure = 0;
for( i = 1; i < BarCount; i++ )
{
if( Buy[i] = 1 )
{
Targetfigure[i] = Close[i];
EntryPriceLong[i] = Open[i];
}
if( Open[ i ] > Targetfigure[i] && Targetfigure[i] > 0)
{
Sell[ i ] = 1;
}
else
Sell[ i ] = 0;
}
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|