- Joined
- 17 June 2019
- Posts
- 19
- Reactions
- 0
Hello,
First ever post here, so if I am in the wrong place - apologies.
Just started with Amibroker...
Here is my code which buys and sells on same day for every trade. Why? Well that's the question...any thoughts appreciated.
_SECTION_BEGIN("AD Price");
function AdvDecWilliams()
{
C1 = Ref( C, -1 );
trhi = IIf( C1 > High, C1, High );
trlo = IIf( C1 < Low, C1, Low );
//return MA(Cum( IIf( C > C1, Close - trlo, Close - trhi ) ),80)/c;
return MA((Cum( IIf( C > C1, Close - trlo, Close - trhi ) )/c),80);
}
//Plot( AdvDecWilliams(), _DEFAULT_NAME(), ParamColor("Color", ColorCycle ) );
_SECTION_END();
Buy = Ref(AdvDecWilliams(), -1) < .01;
//Sell = C > MA(C,55);
//Buy = ExRem(Buy,Sell);
//Sell = ExRem(Sell,Buy);
Sell = 0;
ApplyStop(stopTypeTrailing, stopModePoint, 3*ATR(14), True, True );
shape = Buy * shapeUpArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorGreen ), 0, IIf( Buy, Low, High ) );
PlotShapes( shape, IIf( sell, coloryellow, coloryellow ), 0, IIf( sell, high, low ) );
GraphXSpace = 5;
First ever post here, so if I am in the wrong place - apologies.
Just started with Amibroker...
Here is my code which buys and sells on same day for every trade. Why? Well that's the question...any thoughts appreciated.
_SECTION_BEGIN("AD Price");
function AdvDecWilliams()
{
C1 = Ref( C, -1 );
trhi = IIf( C1 > High, C1, High );
trlo = IIf( C1 < Low, C1, Low );
//return MA(Cum( IIf( C > C1, Close - trlo, Close - trhi ) ),80)/c;
return MA((Cum( IIf( C > C1, Close - trlo, Close - trhi ) )/c),80);
}
//Plot( AdvDecWilliams(), _DEFAULT_NAME(), ParamColor("Color", ColorCycle ) );
_SECTION_END();
Buy = Ref(AdvDecWilliams(), -1) < .01;
//Sell = C > MA(C,55);
//Buy = ExRem(Buy,Sell);
//Sell = ExRem(Sell,Buy);
Sell = 0;
ApplyStop(stopTypeTrailing, stopModePoint, 3*ATR(14), True, True );
shape = Buy * shapeUpArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorGreen ), 0, IIf( Buy, Low, High ) );
PlotShapes( shape, IIf( sell, coloryellow, coloryellow ), 0, IIf( sell, high, low ) );
GraphXSpace = 5;