PureBytes Links
Trading Reference Links
|
Hello,
I wanted to be able to enter trades manually --representing the ideal
discretionary system trades for comparing different automated systems
trying to mimic them. I combined several different ideas I found
here to make the code below.
To operate, you select a name, make an empty ticker, then enable
manual trades, select a bar and place a marker on it.
It remembers the markers and can display them on any chart. The same
idea could be used to mark universal things on a chart such as
options expirations, fed announcements, 9-11, other market moving
news that would affect all charts in back testing. It could also be
modified to switch files 1-1 for each current ticker for ticker
specific events. The advantage is that the data is retained across
different panes etc. --unlike drawn studies which can not be shared,
cut, pasted, and could easily be lost.
So far, I have noticed a couple anomalies in operation that I can't
explain.
The first time I enter a marker after starting AB, it seems to
disappear after a bit and has to be reentered once.
It lost my markers once, and I am not sure why that happened --the
files were still there.
Also, I wanted to have a way to make it hard to clear all the markers
by mistake. I was looking for a way to require the shift key down
when clicking on the make empty ticker button as a fail safe. Or
perhaps there is a way to make a confirmation dialog box.
I would appreciate any help with these issues and comments for
improvements.
You make take the following code and use it or post it however you
like as far as I am concerned.
~Dennis
_SECTION_BEGIN("Manual Trades");
// This section allows manual trades to be entered and saved
permenantly as a ticker
// ~name1 is Buy flags
// ~name2 is Sell flags
// ~name3 is Short flags
// ~name4 is Cover flags
function saveManual(array, ManName)
{AddToComposite(array ,ManName ,"x",atcFlagEnableInIndicator|
atcFlagDefaults);}
function saveAllManual(BuyMan, SellMan, ShortMan, CoverMan, ManName)
{
saveManual(BuyMan , ManName+"1");
saveManual(SellMan , ManName+"2");
saveManual(ShortMan , ManName+"3");
saveManual(CoverMan , ManName+"4");
}
ManualName = ParamStr("Manual Trade Ticker", "~Kezha");
createManual = ParamTrigger("Make Empty Ticker", "Make Empty Ticker" );
EnableManual = ParamToggle("Enable Manual Trades", "OFF|ON" );
setbuy = ParamTrigger("Buy", "Buy" );
setsell = ParamTrigger("Sell", "Sell" );
setshort = ParamTrigger("Short", "Short" );
setcover = ParamTrigger("Cover", "Cover" );
clear = ParamTrigger("Clear", "Clear" );
bi = BarIndex();
sbi = SelectedValue( bi )-bi[0];
if( createManual )
{
saveAllManual(0, 0, 0, 0, ManualName);
}
if( enableManual )
{
BuyMan = Foreign(ManualName+"1" ,"c");
SellMan = Foreign(ManualName+"2" ,"c");
ShortMan = Foreign(ManualName+"3" ,"c");
CoverMan = Foreign(ManualName+"4" ,"c");
if( setbuy ){BuyMan[sbi ] = 1; saveManual(BuyMan , ManualName+"1");}
if( setsell ){SellMan[sbi ] = 1; saveManual(SellMan, ManualName+"2");}
if( setshort ){ShortMan[sbi ] = 1; saveManual(ShortMan, ManualName
+"3");}
if( setcover ){CoverMan[sbi ] = 1; saveManual(CoverMan, ManualName
+"4");}
if( clear )
{
BuyMan[sbi ] = 0;
SellMan[sbi ] = 0;
ShortMan[sbi ] = 0;
CoverMan[sbi ] = 0;
saveAllManual(BuyMan, SellMan, ShortMan, CoverMan, ManualName);
}
PlotShapes( BuyMan * shapeUpArrow,colorGreen,0,L,-25);
PlotShapes( SellMan * shapeDownArrow ,colorRed ,0,H,-25);
PlotShapes( ShortMan * shapeHollowDownTriangle ,colorRed ,0,H,-25);
PlotShapes( CoverMan * shapeHollowUpTriangle,colorGreen,0,L,-25);
}
_SECTION_END();
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
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/
|