[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Trailing Stops in Indicator Builder


  • To: njpowell@xxxx
  • Subject: RE: [amibroker] Trailing Stops in Indicator Builder
  • From: "John Pyle" <jmp23834@xxxx>
  • Date: 21 Nov 2001 14:44:51 -0000

PureBytes Links

Trading Reference Links

Here is some code I use for stops, The color changes depending on if your in or out of the trade. 
 
// Indicators

// Color Legend
Black=0; DkGrey=1; LtGrey=2; White=3; 
Red=4; Green=5; Blue=6; Yellow=7;
Rose=8; Slate=9; Teal=10; Orange=11; 
Purple=12; Pink=13; LtBlue=14; LtGrn=15;
// Plot Style Legend
Normal=1; Histo=2; Fat=4; Dots=8;
NoLine=16; SemiLog=32; Candle=64; Bar=128;
NoDraw=256; Stair=512; Swing=1024; 
 
Change = Flip(Buy,Sell);
Plot(Close,"Close",Black,Candle);
Plot(TrailStop,"TrailStop",IIf(Ref(Change,-1)==1 ,Green,Red),Stair);
Plot(Target,"Target",Black,Normal);
Plot(Entry,"Entry",Yellow,Normal);
Plot(Close*.90,"BS",IIf(Buy,Green,IIf(Sell,Red,LtGrey)),Histo); 
----- Original Message ----- 

From: 
To: amibroker@xxxxxxxxxxxxxxx
Sent: 11/20/01 1:39:38 PM 
Subject: [amibroker] Trailing Stops in Indicator Builder
I'm trying to determine how to display trailing stops on a graph.  Right now I have them listed in the title, is there any way to actually overlay them graphically?  Automatic analysis:Buy = Cross( StochK(),StochD());Sell = Cross( StochD(), StochK());Cover = Cross( StochK(),StochD());Short = Cross( StochD(), StochK());Indicator builder:Graph1 = StochD();Graph0 = StochK();diff = StochK()-StochD();diff1 = IIf( diff>0,diff, 0 - diff);diff2 = diff1 * 3;Graph2 = diff2;bsu=BarsSince(Cross(StochK(),StochD())); /*bars since up cross*/bsd=BarsSince(Cross(StochD(),StochK())); /*bars since down cross*/lv = HHV(Close, bsu); /* high value since buy */sv = LLV(Close, bsd); /* low value since short */Lstop = lv - (lv * .04); /*4% stop*/Sstop = sv + (sv * .04); /*4% stop*/Title=Name() + "- Stochastic Slow - Difference=" + WriteVal(diff1) + "; 4% Long Stop=" + WriteVal(Lstop) + "; pds = " + WriteVal(bsu) + "; 4% Short Stop=" + WriteVal(Sstop) + "; pds = " + WriteVal(bsd);Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

 
--- John Pyle
 
 

Attachment:

Attachment: Description: "Description: rand937937192"

Attachment: Description: "rand937937192"