PureBytes Links
Trading Reference Links
|
I've been messing with scaling into a long position but no such luck. Here is my scaling code:
The Scaling function should work like this:
1) Initial Buy conditions met, buy 20% position
2) First Scale in, buy 30% position if C < Entryprice
3) Second Scale in, buy 50% position if C < C[1]
p1 = 2;
p2 = 3;
p3 = 5;
p4 = 0;
fInTrade=False;
nSize=0;
nBars=0;
nTrade=0;
nBars=0;
ScaleIn=0;
for (i=0;i<BarCount;i++)
{
if (Buy[i] AND !fInTrade)
{
fInTrade = True;
CLast = C[i];
ScaleIn[i]=p1;
iBuy = i;
nTrade++;
nEntry = 1;
}
else if (Sell[i] AND fInTrade)
{
fInTrade = False;
nSize = 0;
}
else if (fInTrade)
{
fScale1 = C[i] < CLast*.995 AND nEntry==1;
fScale2 = C[i] < CLast*.995 AND nEntry==2;
if (fScale1)
{
CLast = C[i];
Buy[i] = sigScaleIn;
ScaleIn[i]=p2;
nEntry++;
}
if (fScale2 )
{
CLast = C[i];
Buy[i] = sigScaleIn;
ScaleIn[i]=p3;
nEntry++;
}
}
}
//These lines were in an example but no idea what it does
//InPos = Flip(Buy, Sell);
//action = IIf(Buy, IIf(Buy==sigScaleIn, ScaleIn, 2), IIf(Sell, -1, 0));
------------------------------------
**** 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/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|