- Joined
- 24 October 2005
- Posts
- 1,302
- Reactions
- 834
[COLOR=#000080]upbar2 = upbar OR ( outsidebar AND Ref( downbar, 1 ) ) ;
downbar2 = downbar OR ( outsidebar AND Ref( upbar, 1 ) );
Poi = outsidebar AND Ref( insidebar, 1 );
Poo = outsidebar AND Ref( outsidebar, 1 );
Pooi = Poo AND Ref( insidebar, 2 );
Poio = Poi AND Ref( outsidebar, 2 );
Poii = Poi AND Ref( insidebar, 2 );
Pooo = Poo AND Ref( outsidebar, 2 );
Poooi = Pooo AND Ref( insidebar, 3 );
Pooio = Pooi AND Ref( outsidebar, 3 );
Poioo = Poio AND Ref( outsidebar, 3 );
upbar3 = upbar2 OR ( Poi AND Ref( downbar, 2 ) );
downbar3 = downbar2 OR ( Poi AND Ref( upbar, 2 ) );
upbar4 = upbar3 OR ( Poo AND Ref( upbar, 2 ) );
downbar4 = downbar3 OR ( Poo AND Ref( downbar, 2 ) );
upbar5 = upbar4 OR ( Pooi AND Ref( upbar, 3 ) );
downbar5 = downbar4 OR ( Pooi AND Ref( downbar, 3 ) );
upbar6 = upbar5 OR ( Poio AND Ref( upbar, 3 ) );
downbar6 = downbar5 OR ( Poio AND Ref( downbar, 3 ) );
upbar7 = upbar6 OR ( Poii AND Ref( downbar, 3 ) );
downbar7 = downbar6 OR ( Poii AND Ref( upbar, 3 ) );
upbar8 = upbar7 OR ( Pooo AND Ref( downbar, 3 ) );
downbar8 = downbar7 OR ( Pooo AND Ref( upbar, 3 ) );
upbar9 = upbar8 OR ( Poooi AND Ref( downbar, 4 ) );
downbar9 = downbar8 OR (Poooi AND Ref( upbar, 4 ) );
upbar10 = upbar9 OR ( Pooio AND Ref( downbar, 4 ) );
downbar10 = downbar9 OR ( Pooio AND Ref( upbar, 4 ) );
upbar11 = upbar10 OR ( Poioo AND Ref( downbar, 4 ) );
downbar11 = downbar10 OR ( Poioo AND Ref( upbar, 4 ) );
[/COLOR]
MaxGraph = 12;
/* Grey lines */
Graph0= EMA( Close, 3 );
Graph1= EMA( Close, 5 );
Graph2= EMA( Close, 7 );
Graph3= EMA( Close, 9 );
Graph4= EMA( Close, 11 );
Graph5= EMA( Close, 13 );
Graph0Style = Graph1Style = Graph2Style = Graph3Style =Graph4Style =Graph5Style = 1;
Graph0Color = Graph1Color = Graph2Color = Graph3Color =Graph4Color =Graph5Color = colorLightGrey;
/* Blue lines */
Graph6= EMA( Close, 21 );
Graph7= EMA( Close, 24 );
Graph8= EMA( Close, 27 );
Graph9= EMA( Close, 30 );
Graph10= EMA( Close, 33 );
Graph11 = EMA( Close, 36 );
Graph6Style = Graph7Style = Graph8Style =Graph9Style =Graph10Style = Graph11Style = 1;
Graph6Color = Graph7Color = Graph8Color =Graph9Color =Graph10Color = Graph11Color = colorBlueGrey;
sma=(Graph0-Graph5);
Lma=(Graph6-Graph11);
Buy = sma > Lma;
Sell = lMA > sMA;
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBrightGreen);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed);
multiplier = Optimize("ATR Multiplier", 2.2, 0, 10, 0.1);
Buy = Close > Ref( High , -1 )
;
Sell = 0;
_SECTION_BEGIN("ATR Trailing Stop");
multiplier = Param("ATR Multiplier", 2.2, 0, 10, 0.1);
// ATR Trailing stop - stevo 2006
// When stop line drops exit is triggered.
myATR= multiplier*ATR(10); // calculate ATR
initial=C-myATR; // raw stop - not racheted
stop[ 0 ] = Close[ 0 ];
for( i = 1 ; i < BarCount; i++)
{
if( Close[ i ] > stop[ i - 1])
{
temp = Close[ i ] - myATR[ i ];
if( temp > stop[ i - 1 ] ) stop[ i ] = temp;
else stop[ i ] = stop[ i - 1 ];
}
else
stop[ i ] = initial[ i ];
}
Sell = C < Ref( stop, -1);
Plot( stop, "ATR Stop", colorRed, styleLine);
Hi
Can anyone please help me. Im trying to optimise this ATR Trailing stop. Im not sure how to get it to work.
Thanks
multiplier = Optimize("ATR Multiplier", 2.2, 0, 10, 0.1);
period = Optimize("Period", 10, 5, 100, 5);
myATR = multiplier*ATR(period);
multiplier = Optimize("ATR Multiplier", 2.2, 0, 10, 0.1);
Hi Wysiwyg
Thanks for that. I tried it but Im still having trouble. Im happy with the 10 period setting. What Im trying to optimise is the multiplier and
doesnt seem to work. I get the same result on all settings.HTML:multiplier = Optimize("ATR Multiplier", 2.2, 0, 10, 0.1);
Hi Wysiwyg
Thanks for that. I tried it but Im still having trouble. Im happy with the 10 period setting. What Im trying to optimise is the multiplier and
doesnt seem to work. I get the same result on all settings.HTML:multiplier = Optimize("ATR Multiplier", 2.2, 0, 10, 0.1);
multiplier = Param("ATR Multiplier", 2.2, 0, 10, 0.1);
initial=C-myATR;
There is one other problem. How do I convert my initial stop to be a max loss of 2% from the buy price? Its currently
HTML:initial=C-myATR;
Buy = Cross(MACD(), Signal());
Sell - 0;
Short = Cross(70, RSI());
Cover = 0;
ApplyStop(stopTypeTrailing, stopModePercent, 0.20, 2); // Trailer for Longs
ApplyStop(stopTypeTrailing, stopModePercent, 0.10, 2); // Trailer for Shorts
There needs to be a function that links the Long trailing stop to the Buy and the Short trailing stop to the Sell.
Yes thanks CB. I will stay with the looping trailer.Very busy atm so haven't been able to add too much to this thread, will look through some posts when I get time and try to help if I can.
Wysiwyg, is this formula from the library any help?
http://www.amibroker.com/library/detail.php?id=1133
initial = C - 0.02;
Adds. Here is a guide to set up the composite indicators. I haven't used it.
http://www.amibroker.com/newsletter/04-2000.html
I purchased the latter so don't know what the comparison is. In my opinion Ami. is immensely versatile yet can be used with little or no AFL knowledge. Although you will need to learn the language if you want to transfer your ideas into AFL for strategy testing, custom indicators, scanning and exploration etc. I get by with a little help from the more advanced AFL ers such as Cap. Black and Mike on AMI. Yahoo Forum along with the various formulas that are available to owners in the AFL library.I'm trying to decide which version of AmiBroker would be right for me.
From poking around there is AmiBroker Standard Edition and AmiBroker Professional edition.
Thanks in advance for the feedback.
No pennies it is one of the many indicators I haven't used.Hi Wysiwyg
Did you ever get that advance decline line working? I contacted Amibroker to get the run down on how to set one up but it sounds really complicated. I have no idea how to use the "add to composite function" . Just wondering how hard it was?
I lost the key awhile ago and this is what AB told me to do. I have removed the link code obviously and I don't know if it will trigger any memories for you so good luck with it.Just built a new PC and am moving over programs any tips on AB.....cannot remember what to do with the software key.
INSTRUCTIONS HOW TO APPLY THE KEY FILE:
In order to activate the software please download
and run the software activation wizard from:
http://reg.amibroker.com/ABRegxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
If you are running 64 bit version of AmiBroker on x64 Windows, please use 64-bit activation key from:
http://reg.amibroker.com/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Simply CLICK on the link(s) above, do not re-type manually as it is too easy to make a mistake.
After that, please start AmiBroker and choose Help->About menu to see your name displayed.
IMPORTANT:
Please DO NOT reveal this password and user name to anyone.
No-one from amibroker.com will ever request you to provide these details and any e-mail that is trying to persuade you to reveal this information is hijack attempt.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?