 | Notes for this Trading Account: |
 | Rules for this Trading Account: |
 | Notes for this Trading System: |
 | Rules for this Trading System: |
 | Bar event logic: |
my $ADXLength=30;
my $ShortAverage=10;
my $LongAverage=35;
my $period = 14;
my $dev = 2;
my $stop=$fixed_stop_percent/100;
#Bollinger Bands for Today
my $ma = Today(SMA(Close,$period));
my $sta = $dev*Today(StaDev(Close,$period));
my $bollupper=$sta+$ma;
my $bolllower=$ma-$sta;
#Bollinger Bands for Yesterday
my $ma = Yesterday(SMA(Close,$period));
my $sta = $dev*Yesterday(StaDev(Close,$period));
my $ybollupper=$sta+$ma;
my $ybolllower=$ma-$sta;
#Bollinger Bands for Two Days Ago
my $ma = Ago(SMA(Close,$period),2);
my $sta = $dev*Ago(StaDev(Close,$period),2);
my $y_two_bollupper=$sta+$ma;
my $y_two_bolllower=$ma-$sta;
#Only test the symbol if we do not hold a position. Today(EMA(Close,200))>Today(EMA(Close,300))) & (Today(Close))>Today(EMA(Close,50)) &
#Only & (Today(EMA(Close, $period))>Ago(EMA(Close,$period),7))
if (not Position) {
if((Today(Close)<Yesterday(Highest(High,200)) ) & (Today(EMA(Close, $period))>Ago(EMA(Close,$period),7)) ) {
if ((Today(Low)>$bolllower ) & (Yesterday(Low)<$ybolllower )) {
BuyOpen;
}
}
}
#Exit
if (Position & (BarsSinceEntry<$BarsSinceEntry)) {
if (Today(High)<$bolllower)
{
SellOpen
}
else {
if (Today(ADX($ADXLength))>22) {
if (Crossunder(EMA(Close,$ShortAverage),EMA(Close,$LongAverage))) {
SellOpen;
Output("Sold on average cross")
}
else {
if (Today(Close)<(EnterPrice-(EnterPrice*$stop))) {
Output(" EVAL 2 STOP Close =", Today(Close), "EnterPrice =", EnterPrice);
SellOpen
}
}
}
else {
if ( ( (Today(High)<$bollupper) & (Yesterday(High)>$ybollupper)) | ( (Today(High)<$bollupper) & (Ago(High,2)>$ybollupper)) ) {
SellOpen
}
else {
Output(" EVAL STOP Close =", Today(Close), " EnterPrice =", EnterPrice," StopPrice = ",EnterPrice-(EnterPrice*$stop));
if (Today(Close)<(EnterPrice-(EnterPrice*$stop))) {
Output(" EVAL STOP Close =", Today(Close), "EnterPrice =", EnterPrice);
SellOpen
}
}
}
}
}
SellOpen if (BarsSinceEntry>$BarsSinceEntry)
|