Re: [amibroker] Re: Help with Code for MA Cross Over - Ribbon Indictor

2010-09-09 Thread cas soni
Hello Ken,
check  this
 
P = ParamField(Price field,-1);
Periods = Param(Periods, 15, 2, 300, 1 );
Width = Param(Width%, 2, 0, 10, 0.05 );
Color = ParamColor(Color, colorCycle );
Style = ParamStyle(Style);
CenterLine = MA( P, Periods );
Plot( (1 + Width * 0.01) * CenterLine, %EnvTop + _PARAM_VALUES(), Color, 
Style ); 
Plot( (1 - Width * 0.01) * CenterLine, %EnvBot + _PARAM_VALUES(), Color, 
Style );
CenterLine2 = MA(CenterLine,100);
Plot( (1 + Width * 0.01) * CenterLine2, %EnvTop + _PARAM_VALUES(), 6, 32 ); 
Plot( (1 - Width * 0.01) * CenterLine2, %EnvBot + _PARAM_VALUES(), 6, 32 );
 
Thank you
bye the way.. how do you intrepret your previous code ?? (MA Cross Over - 
Ribbon )  

--- On Thu, 9/9/10, Ken H sfehe...@yahoo.com.au wrote:


From: Ken H sfehe...@yahoo.com.au
Subject: Re: [amibroker] Re: Help with Code for MA Cross Over - Ribbon Indictor
To: amibroker@yahoogroups.com
Date: Thursday, 9 September, 2010, 7:30 AM


  








Thanks guys for the help to resolve my problem with the ribbon indicator 
code.   It is greatly appreciated.
 
If I can just ask for help one more time please.  
 
I am sure it is very simple to do but as much as I play around, I can't get the 
percent band code below to lock to a MA instead of the close.   
 
Can anyone suggest what I need to do?
 
Many thanks again
 
Ken
 
 
_SECTION_BEGIN(Percent Bands);
P = ParamField(MA1(Close,100,-1);
Periods = Param(Periods, 15, 2, 300, 1 );
Width = Param(Width%, 2, 0, 10, 0.05 );
Color = ParamColor(Color, colorCycle );
Style = ParamStyle(Style);
CenterLine = MA( P, Periods );
Plot( (1 + Width * 0.01) * CenterLine, %EnvTop + _PARAM_VALUES(), Color, 
Style ); 
Plot( (1 - Width * 0.01) * CenterLine, %EnvBot + _PARAM_VALUES(), Color, 
Style ); 
_SECTION_END(); 

 
 








Re: [amibroker] Moving Average

2010-09-01 Thread cas soni
Hello denis ,
The average is shifted back 9-bars.
it should be
x= Ref(MA(mp,18) , -9 );


--- On Wed, 1/9/10, Dennis Lipter blackca...@verizon.net wrote:


From: Dennis Lipter blackca...@verizon.net
Subject: [amibroker] Moving Average
To: amibroker@yahoogroups.com
Date: Wednesday, 1 September, 2010, 12:07 PM


  





The code below is for a centered moving average.
The average is shifted back 9-bars.
The problem is that for those 9-bars, a flat line is plotted. I would prefer to 
have that portion of the plot blank instead of the flat line. 
 
mp=IIf(C,(H+L+C)/3,(H+L)/2);
x= Ref(MA(mp,18),9);
Plot(x,Centered MA-18 ,colorRed);
 
Ideas would be appreciated.
Thanks








Re: [amibroker] Re: Formula Help Needed

2010-08-28 Thread cas soni
Hello Edward,wow..great .   .i was looking for something like this [ i.e- your 
code ]Thank you

--- On Sun, 29/8/10, Edward Pottasch empotta...@skynet.be wrote:

From: Edward Pottasch empotta...@skynet.be
Subject: Re: [amibroker] Re: Formula Help Needed
To: amibroker@yahoogroups.com
Date: Sunday, 29 August, 2010, 1:18 AM















 
 



  



  
  
  


Jeff,
 
I agree with cas soni that plotting the problem makes it 
easier to solve.
 
You can use the valuewhen() function but the 
problem is that before a sell is found new buy signals emerge. That is why I 
would solve such a problem using an exit loop. See code below. If this can be 
solved using array calculations only I woud not know how,
 
regards, Ed
 
 
procedure 
buySell_proc(BuyXX,sellStopProfit,sellStopLoss,initPer) 
{
global 
BuyAdjusted;
global BuyPriceAdjusted;
global SellAdjusted;
global 
SellPriceAdjusted;
global stopProfitArray;
global 
stopLossArray;
 
BuyAdjusted = 0;
BuyPriceAdjusted = 
0;
SellAdjusted = 0;
SellPriceAdjusted = 0;
stopProfitArray = 
Null;
stopLossArray = Null;
slip = 0;
 
for( i = initPer + 1; i  BarCount; i++ ) 

{
 if (BuyXX[ i ]) 
 {
  BuyAdjusted[ i ] = 
1;
  BuyPriceAdjusted[ i ] = C[ i ] + 
slip;
  stopProfitArray[ i ] = BuyPriceAdjusted[ i ] + 
sellStopProfit[ i ];
  stopLossArray[ i ] = BuyPriceAdjusted[ i ] - 
sellStopLoss[ i ];
  
  for (j = i + 1; j  
BarCount; j++) 
  { 
   stopLossArray[ j ] = 
stopLossArray[ i ];
   stopProfitArray[ j ] = stopProfitArray[ 
i ];
   // exit at stop loss
   if (C[ j ] 
 stopLossArray[ j 
])
   {
SellAdjusted[ j ] = 
1;
SellPriceAdjusted[ j ] = C[ j ] - 
slip;
i = 
j;
break;
   }  
   // 
exit at stop profit
   else if (C[ j ]  stopProfitArray[ j 
])
   {
SellAdjusted[ j ] = 
1;
SellPriceAdjusted[ j ] = C[ j ]- 
slip;
i = 
j;
break;
   }
   // 
to avoid problems at the end of the array
   else if (j == 
BarCount - 1) 
   { 
i = 
BarCount;
break;
   }
  }
 } 

} 
}
 
SetBarsRequired(sbrAll,sbrAll);
 
ATRx = Optimize(ATR Multiplier, 3, 1, 5, 1); // ATR 
Multiplier
WATR = ((Ref(ATR(8),-2)*8) + (ATR(1)*1.125) + 
(Ref(ATR(1)*1.125,-1)))/10; //Weighted ATR (last 20% has a 12.5% weighting 
factor)
twentydayupper = Ref(HHV(H, 20), -1);
 
BuyXX = Cross(C, 
twentydayupper);
buySell_proc(BuyXX,WATR*ATRx,WATR*2,8);
Buy = 
BuyAdjusted;
BuyPrice = BuyPriceAdjusted;
Sell = 
SellAdjusted;
SellPrice = SellPriceAdjusted;
 
// chart
GraphXSpace = 5;
SetChartOptions(0, 
chartShowDates);
Plot( C, \nCandle,colorWhite, styleCandle 
);
Plot(twentydayupper,,colorBlue,1); 

Plot(stopLossArray,\nsellStopLoss,colorRed,1);
Plot(stopProfitArray,\nsellStopProfit,colorGreen,1);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-15);
PlotShapes(IIf(Buy,shapeHollowSmallCircle,shapeNone),colorWhite,0,BuyPrice,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell,shapeHollowSmallCircle,shapeNone),colorWhite,0,SellPrice,0);
 




From: JEFF F 
Sent: Saturday, August 28, 2010 7:14 PM
To: amibroker@yahoogroups.com 
Subject: [amibroker] Re: Formula Help Needed

  

Thanks cas soni,
I appreciate your input, and adding the plot. The problem 
I am having is the sellprice and sellstop seem to be floating numbers and 
recalculated every day. I want them to be calculated once at entry, and remain 
that fixed value until a sell is triggered. Any help is much 
appreciated.

--- In amibroker@yahoogroups.com, cas soni 
soni...@... wrote:

 Hello Jeff ,
 First let me say 
i am not an afl expert , 
 so please try this  
 ATRx = 
Optimize(ATR Multiplier, 3, 1, 5, 1); // ATR Multiplier 
 WATR = 
(Ref(ATR(8),-2)*8 + (ATR(1)*1.125) + (Ref(ATR(1)*1.125,-1)))/10; //Weighted ATR 
(last 20% has a 12.5% weighting factor) 
 twentydayupper = Ref(HHV(H, 
20), -1); 
 
 
 
 Plot(C,,3,64); 
 
Plot(twentydayupper,,7,1); 
 
 
 Buy = Cross(C, 
twentydayupper); 
 
 BuyPrice=ValueWhen(Buy,C,1); 
 

 Sellstop = BuyPrice - WATR*2; 
 
 SellPrice = BuyPrice + 
WATR*ATRx; 
 Sell = Cross(Sellstop, C) OR Cross(C, SellPrice); 
 
Plot(SellPrice,sellprice,4,1); 
 Plot(Sellstop,sellstop,6,1); 

 
 PlotShapes(Buy*shapeUpArrow,colorGreen,0,L,-5); 
 
PlotShapes(Sell*shapeDownArrow,colorRed,0,H,-5); 
 
 
AddColumn(ATRx, ATRx); 
 AddColumn(ATR(10), ATR); 
 
AddColumn(WATR, Weighted ATR); 
 AddColumn(Ref(ATR(8),-2), ATR(8) Two 
Days Ago); 
 AddColumn(ATR(1)*1.125, Weighted ATR Today); 
 
AddColumn(Ref(ATR(1)*1.125,-1), Weighted ATR Yesterday); 
 
AddColumn(twentydayupper, 20 Day Upper); 
 AddColumn(Sellstop, 
Sellstop); 
 AddColumn(SellPrice, SellPrice); 
 
AddColumn(BuyPrice, BuyPrice); 
 AddColumn(C, Close); 
 

 Filter=1; 
 Hope this helps
 Thank you
 
 
--- On Sat, 28/8/10, JEFF F je...@... wrote:
 
 
 
From: JEFF F je...@...
 Subject: [amibroker] Formula Help 
Needed
 To: amibroker@yahoogroups.com
 
Date: Saturday, 28 August, 2010, 8:53 PM
 
 
   

 
 
 
 If one of the AFL experts out there could 
help me out, it would be greatly appreciated. I do

Re: [amibroker] Re: Multiple indicators combined to generate a Buy Sell signal - In one code

2010-08-10 Thread cas soni

Hello bobby,i think this is what you need to do price=c;buy=  (Price 
EMA(Price,14)) AND (Price  MA(Price,20)) AND (Accdist()  MA(Accdist(),20)) 
AND (Accdist  EMA(Accdist(),14)) vice versa for sell ..thank you--- On Wed, 
11/8/10, A arbhap...@yahoo.com wrote:

From: A arbhap...@yahoo.com
Subject: [amibroker] Re: Multiple indicators combined to generate a Buy Sell 
signal - In one code
To: amibroker@yahoogroups.com
Date: Wednesday, 11 August, 2010, 12:55 AM















 
 



  



  
  
  Hello,

Repeating my Request for help in coding the following...



--- In amibroker@yahoogroups.com, Bobby R bobby6...@... wrote:



 Dear Members,

 

 Pls help

 

 warm regards...bobby

 

 --- In amibroker@yahoogroups.com, Bobby R bobby6910@ wrote:

 

  Hello,

  

  I need some help in coding the below mentioned conditions to generate: BUY 
  signal :

  (Price 14EMA) AND (Price  20MA) AND (Accdist()  MA(Accdist(),20)) AND 
  (Accdist  EMA(Accdist(),14))

  

  and vice versa for SELL

  (Price  14EMA) AND (Price 20MA)AND (Accdist()  MA(Accdist(),20)) AND 
  (Accdist  EMA(Accdist(),14))

  

  

  Can we combine multiple indicators to generate Buy/Sell signals ?

  

  Also request for code to give alert output (sound) - suppressing multiple 
  sound alarms AND output in the Alert Window

  

  Requesting the pro's to help coding

  

  Warm Regards...Bobby

 








 





 



  












Re: [amibroker] Using BuyStop and SellStop orders - How does it work?

2010-07-29 Thread cas soni
Hello pcmoxon,you didn't use PLOT..add this lines  SetChartOptions(0, 
chartShowDates); Plot(C,Close,colorWhite,64);



PlotShapes(IIf(Buy , shapeSmallUpTriangle, shapeNone) ,colorGreen, 0,L,-20); 

PlotShapes(IIf(Sell  , shapeSmallDownTriangle, shapeNone) ,colorRed, 0,H,-20);



Plot(MA1,\nDynPiv25,ParamColor(Color 1,ColorRGB(238,174,238)),stylethick);

Plot(MA2,\nDynPiv50,ParamColor(Color1 2,ColorRGB(255,20,147)),styleline);
and make sure your market start time / end time is correctly set

Thank you
--- On Fri, 30/7/10, pcmoxon teklin...@googlemail.com wrote:

From: pcmoxon teklin...@googlemail.com
Subject: [amibroker] Using BuyStop and SellStop orders - How does it work?
To: amibroker@yahoogroups.com
Date: Friday, 30 July, 2010, 12:01 AM















 
 



  



  
  
  Hi,



I am trying to test a simple MA Cross over system that uses Buy-Stop and 
Sell-Stop orders. I can't for the life Of me workout how this should work.



What I want the system to do is only trade between the 'tstart'  'tend' 
parameter. When there is a MA-Cross set a BuyStop or Sell stop order at the 
High/Low of the bar where the MA-Cross ocurred, so the trade is only entered 
when the stop order is taken out.



I would be very gratefull if someone can take a look at my code below and point 
me in the right direction to get this to work.



Thanks,

Pete



//

   //+--+

   //| Variable/Parameters Start|

   //+--+

//  Set up the lengths for the moving averages

Length1= Param(Fast MA,3,1,20,1);

Length2= Param(Slow MA,30,21,80,1);

// Trade Times

tstart = 07; 

tend   = 15; 

time_valid = TimeNum() = tstart AND TimeNum() = tend; 



//+--+

   //| Buy Sell Logic   |

   //+--+

MA1 = MA(C,Length1);

MA2 = MA(C,Length2);



Buy   = Ref(Cross(MA1,MA2),-1) AND time_valid;

Short = Ref(Cross(MA2,MA1),-1) AND time_valid;

Sell = Short;

Cover = Buy;



BuyStop  = Ref(H,-1);

SellStop = Ref(L,-1);



BuyPrice  = Max( BuyStop, Low ); // make sure buy price not less than Low 

SellPrice = Min( SellStop, High ); // make sure sell price not greater than 
High 



Buy  = ExRem(Buy,Sell);

Sell = ExRem(Sell,Buy);






 





 



  












Re: [amibroker] Req help coding problems bars since crossover and exploration-same stock

2010-07-28 Thread cas soni
Hello  Inquisitive Voyager,
I think you need to add this lines ,
 
Filter=Buy OR Sell or f or g ;
AddColumn(d,barssince,1.2);
AddColumn(f,barssince up,1);
AddColumn(g,barssince dw,1);
 
Thank you


--- On Wed, 28/7/10, Inquisitive Voyager hedonist2...@gmail.com wrote:


From: Inquisitive Voyager hedonist2...@gmail.com
Subject: Re: [amibroker] Req help coding problems bars since crossover and 
exploration-same stock [1 Attachment]
To: amibroker@yahoogroups.com
Date: Wednesday, 28 July, 2010, 5:59 PM


  


[Attachment(s) from Inquisitive Voyager included below] 

(1) try the attachment.
 
(2) for second problem: adjust range parameters in AA .

On Tue, Jul 27, 2010 at 9:44 PM, ford7k for...@yahoo. com wrote:


  




Hi Afl experts

Please help with minor problem -coding lines needed

First thing

In the exploration I like to get buy=upcrossover( say 50M over 200MA)
SELL = 50MA BELOW 200MA
So far no prob
I want to know in the exploration, that
how many bars passed since latest,most recent crossover for buy and for 
crossover sell.

I tried barssince but nothing happening.
Can somebody guide me please-may be doing something wrong.

Second problem

I run an exploration in intraday or daily.
I get same stock appearing manytimes. How to get one stock appear only onetime?
May be there are signals for buy or sell for just ten stocks but if each stock 
appears over 7 times or 10 times,I feel it as a problem.

thanks in advance
regards
ford












Re: [amibroker] brain trend afl

2010-07-24 Thread cas soni
Hello santhosh,
Check ,   tatechnics.in ..  i think. Kbrain is almost / equal to brain trend .
Thank you 

--- On Thu, 22/7/10, santhosh santhosh3d2...@yahoo.com wrote:


From: santhosh santhosh3d2...@yahoo.com
Subject: [amibroker] brain trend afl
To: amibroker@yahoogroups.com
Date: Thursday, 22 July, 2010, 3:01 PM


  



hello friends,
ihave brain trend.mq4 indicator... now need its covert to afl 
formula.. can any body help me.plz 

//+--+
//| BrainTrend2StopLine.mq4 |
//| www.forex-tsd.com |
//| Nick Bilak |
//+--+
#property copyright Copyright © 2005, MetaQuotes Software Corp.
#property link www.forex-tsd.com

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
// input parameters
extern int NumBars=500;
extern int EnableAlerts=0;
// buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double spread;
//+--+
//| Custom indicator initialization function |
//+--+
int init()
{
// indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
spread=MarketInfo(Symbol(),MODE_SPREAD)*Point;
//
return(0);
}
//+--+
//| Custor indicator deinitialization function |
//+--+
int deinit()
{
// 

//
return(0);
}
//+--+
//| Custom indicator iteration function |
//+--+
int start() {
int counted_bars=IndicatorCounted();

int artp=7;
double cecf=0.7;
int satb=2000;
int Shift=0;
bool river=True;
double Emaxtra=0;
double widcha=0;
double TR=0;
double Values[100];
int glava=0;
double ATR=0;
int J=0;
double Weight=0;
double r=0;
double r1=0;
int p=0;
int Curr=0;
double Range1=0;
double s=2;
double f=10;
double value3=0;
double h11=0;
double h12=0;
double h13=0;
double const=0;
double orig=0;
double st=0;
double h2=0;
double h1=0;
double h10=0;
double sxs=0;
double sms=0;
double temp=0;
double h5=0;
double r1s=0;
double r2s=0;
double r3s=0;
double r4s=0;
double pt=0;
double pts=0;
double r2=0;
double r3=0;
double r4=0;
double tt=0;

if (Bars  NumBars) satb = Bars; else satb = NumBars;
if (Close[satb - 2]  Close[satb - 1]) river = True; else river = False;
Emaxtra = Close[satb - 2];
for (Shift = satb - 3; Shift=0; Shift--) {
TR = spread + High[Shift] - Low[Shift];
if (MathAbs(spread + High[Shift] - Close[Shift + 1])  TR) TR = MathAbs(spread 
+ High[Shift] - Close[Shift + 1]);
if (MathAbs(Low[Shift] - Close[Shift + 1])  TR) TR = MathAbs(Low[Shift] - 
Close[Shift + 1]);
if (Shift == satb - 3) {
for (J = 0; J=artp - 1; J++) { Values[J] = TR; }
}
Values[glava] = TR;
ATR = 0;
Weight = artp;
Curr = glava;
for (J = 0; J=artp - 1; J++) {
ATR += Values[Curr] * Weight;
Weight -= 1;
Curr -= 1;
if (Curr == -1) Curr = artp - 1;
}
ATR = 2.0 * ATR / (artp * (artp + 1.0));
glava += 1;
if (glava == artp) glava = 0;
widcha = cecf * ATR;
if (river  Low[Shift]  Emaxtra - widcha) {
river = False;
Emaxtra = spread + High[Shift];
}
if (!river  spread + High[Shift]  Emaxtra + widcha) {
river = True;
Emaxtra = Low[Shift];
}
if (river  Low[Shift]  Emaxtra) {
Emaxtra = Low[Shift];
}
if (!river  spread + High[Shift]  Emaxtra) {
Emaxtra = spread + High[Shift];
}
Range1 = iATR(NULL,0,10,Shift)+spread/10.0;
if (river) {
if (Low[Shift] - Range1 * s  r  r != 0) r1 = r; else r1 = Low[Shift] - 
Range1 * s / 3.0;
if (p == 2) r1 = Low[Shift] - Range1 * s / 3.0;
ExtMapBuffer1[Shift]=r1;
ExtMapBuffer2[Shift]=0; 
r = r1;
p = 1;
} else {
if (spread + High[Shift] + Range1 * s  r  r != 0) r1 = r; else r1 = spread + 
High[Shift] + Range1 * s / 3.0;
if (p == 1) r1 = spread + High[Shift] + Range1 * s / 3.0;
ExtMapBuffer1[Shift]=0;
ExtMapBuffer2[Shift]=r1; 
r = r1;
p = 2;
}
}
}










[amibroker] RE - 5.30.3 [1 Attachment]

2010-07-21 Thread cas soni
sir,
i have installed new version 5.30.3.5106 .and i found that when ever i start 
amibroker , chart gets plotted from the begining [ first data ] please check 
this image.
Kindly guide me if i am doing anything wrong
Thank you 



Re: [amibroker] Re: pl. code this

2010-07-18 Thread cas soni
Hello ,I had given you BBsqueeze .afl  indicator long time ago...use that..i 
think it is same as per mt4 indicator..* i dont have that afl have a nice time. 
.

--- On Sun, 18/7/10, bharat bharat_parth2...@yahoo.com wrote:

From: bharat bharat_parth2...@yahoo.com
Subject: [amibroker] Re: pl. code this
To: amibroker@yahoogroups.com
Date: Sunday, 18 July, 2010, 5:41 PM















 
 



  



  
  
  Hi



Found full MT4 code for this.Pl. Code AFL  



===

// This indicator is based on a strategy mentioned in John Carter's book, 
Mastering the Trade. The basic idea 

// behind the strategy is that markets tend to move from periods of low 
volatility to high volatility and

// visa versa. The strategy aims to capture moves from low to high volatility. 
For gauging this he uses two 

// common indicators - Bollinger Bands and Keltner Channels (ok, not so 
common!). He also uses the Momentum 

// indicator to provide a trade bias as soon as the Bollinger Bands come back 
outside the Keltner Channels.

// 

// The Squeeze_Break indicator combines this into a signal indicator and has 
the following components:

// 1. A positive green histogram means that the Bollinger Bands are outside 
the Keltner Channels

// and the market is lightly to be trending or volatile. The stronger the 
histogram the stronger 

// the directional price move.

// 2. A negative red histogram means that the Bollinger Bands are inside 
the Keltner Channels 

// and the market is lightly to be consolidating. The stronger the red 
histogram the tighter

// price action is becoming.

// 3. Incorporated into the indicator is a Momentum indicator. According to 
the strategy J. Carter

// goes long when the Bollinger Bands break outside the Keltner Bands and 
the Momentum indicator 

// is above the zero line. He goes short when the Momentum indicator is 
below the zero line on the 

//break.

// 4. I've also added other indicator info in the top left hand corner to 
give a broader idea 

// of current market conditions.

// 5. The indicator provides audio alerts when a potential breakout is 
occurring.  

// 

// This indicator tends to be better with the larger timeframes. Personally I 
don't trade on an alert 

// signal alone. It's just a handy tool for warning me of potential breakout 
trades. 

// 
===

 

#property copyright DesORegan

#property link  mailto: oregan_...@hotmail.com

 

 

 

// 

// indicator properties

// 

#property indicator_separate_window

#property indicator_buffers 3

#property indicator_color1 ForestGreen

#property indicator_color2 Red

#property indicator_color3 Blue

 

 

// ===

// User Inputs

// ===

extern int   Boll_Period=20;

extern doubleBoll_Dev=2.0;

extern int   Keltner_Period=20;

extern doubleKeltner_Mul=1.5;

extern int   Momentum_Period=12;

extern int   Back_Bars=1000;

extern bool  Alert_On=true;

extern bool  On_Screen_Info=true;

 

 

// =

// Buffer Array Declarations

// =

double Pos_Diff[];   // Pos Histogram

double Neg_Diff[];   // Neg Histogram

double Momentum[];   // Momentum Indicator 

 

 

// ===

// Internal Array Declarations

// ===

double   Squeeze[];  // Used to track which i (index value) is above 

 // and below zero line. 0 followed by 1 triggers alert 

 

// =

// Internal Global Variables

// =

 

datetimeLast_Alert_Time = 0;  // Used to prevent continuous alerts on 
current bar 

 

 

//+--+

//| Custom indicator initialization function |

//+--+

int init()

   {

   

   IndicatorDigits(4);  // indicator value precision

 

   

   //==

   // Indicator Setup

   //==

   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,3);

   SetIndexBuffer(0,Pos_Diff);

   SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,3);

   SetIndexBuffer(1,Neg_Diff);

   SetIndexStyle(2,DRAW_LINE,STYLE_DOT);

   SetIndexBuffer(2,Momentum);   

 

 

   // ===

   // Indicator Labels

   // ===

   IndicatorShortName(Squeeze_Break 
(Boll:+Boll_Period+,+DoubleToStr(Boll_Dev,1)+;Kelt:+Keltner_Period+,+DoubleToStr(Keltner_Mul,1)+;Mom:+Momentum_Period+));
  

   

   

   // 

   // Array Initialization

   // 

   ArrayResize(Squeeze, Back_Bars); // 

Re: [amibroker] SCREEN SHOTs - AFLS request

2010-02-14 Thread cas soni
Hello kalpana,
first image [ forumla name = the foundation] , and its posted on traderji.com , 
rest 2 i dont know .
Thank you

--- On Sat, 13/2/10, Kalpana Samudrala samudralakalp...@yahoo.com wrote:


From: Kalpana Samudrala samudralakalp...@yahoo.com
Subject: [amibroker] SCREEN SHOTs - AFLS request [3 Attachments]
To: Amibroker amibroker@yahoogroups.com
Date: Saturday, 13 February, 2010, 8:37 PM


  


[Attachment(s) from Kalpana Samudrala included below] 


Hai Friends


I saw some screen shots in the web.


I need those Afls if anybody having them


Please forward  or provide link where it is available.


If anybody using may please send AFL


Thanks
samudralakalpana



New Email addresses available on Yahoo! 
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does! 







  Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! 
http://downloads.yahoo.com/in/internetexplorer/

Re: [amibroker] Need help for price oscillator

2009-12-26 Thread cas soni
Hello kamal,
you want something like this ?

r1 = Param( Fast avg, 5, 2, 200, 1 );
r2 = Param( Slow avg, 35, 2, 200, 1 );
Plot(OscP( r1,r2), _DEFAULT_NAME( ),IIf(OscP( r1,r2)0,5,4) , styleNoTitle | 
ParamStyle( Histogram style, styleHistogram | styleNoLabel, maskHistogram));
Plot(MA(OscP(r1,r2),5),,IIf(OscP(r1,r2)0,5,4),1);

Thank you

--- On Sun, 27/12/09, kml_soni1973 kml_soni1...@yahoo.com wrote:

From: kml_soni1973 kml_soni1...@yahoo.com
Subject: [amibroker] Need help for price oscillator
To: amibroker@yahoogroups.com
Date: Sunday, 27 December, 2009, 7:25 AM







 



  



  
  
  Hello,

I want to add 2 moving averages for oscillator i.e separate moving average for 
positive and negative signal. Follwing are the oscillator formula:-

r1 = Param( Fast avg, 5, 2, 200, 1 );

r2 = Param( Slow avg, 35, 2, 200, 1 );

Plot(OscP( r1,r2), _DEFAULT_NAME( ), ParamColor( Histogram color, 
colorCustom12 ), styleNoTitle | ParamStyle( Histogram style, styleHistogram | 
styleNoLabel, maskHistogram ) );

Please help me in this regard.



Regards,

Kamal






 





 



  






  The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

Re: [amibroker] Re=Days since DMI crossover

2009-11-22 Thread cas soni

Hello alan,
Everything is good at my end...i checked / confirmed with charts bar per bar 
basis..in both scan and exploration mode
* add this for exploration
 
BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
Filter=Buy OR Sell ; 
AddColumn(IIf(Buy,BuyPrice,Null),Buy Price, 6.2,1,colorGreen,70);
AddColumn(IIf(Sell,SellPrice,Null),sell Price, 6.2,1,colorOrange,70);
 
Thank you

--- On Sun, 22/11/09, Alan a...@thenorthams.us wrote:


From: Alan a...@thenorthams.us
Subject: Re: [amibroker] Re=Days since DMI crossover
To: amibroker@yahoogroups.com
Date: Sunday, 22 November, 2009, 7:59 PM


Hi soni67c:

Thanks for the code. I tried it and here is a snippit of the results 
after a scan:

Ticker     Trade     Date     Close     
AAPL     Sell     10/28/2009     192.4     
AAPL     Buy     11/5/2009     194.03     
AAPL     Sell     11/20/2009     199.92     
ADBE     Sell     10/22/2009     35.17     


This table shows a sell signal on 10/28/09 while MDI is still positive, 
a buy signal on 11/05 when on the stock chart is shows a buy signal on 
11/04, and the table shows a sell signal on 11/20/09 again while MDI is 
still positive. So I must not be doing something right. I am using a 
filter list of the 's and Scan set for n=30. Any ideas why I am 
getting these results?

Regards,
Alan

soni67c wrote:

 Hello Alan,
 Check this formula...this is what you want :).

 Range = Param( +DI - D range, 10, 5, 30,1 );
 Plot(PDI(Range),,5,1);
 Plot(MDI(Range),,4,1);
 Plot(ADX(Range),,13,1);
 Buy = Cross(PDI(Range), MDI(Range));
 Sell = Cross(MDI(Range), PDI(Range));
 PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
 PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
 bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )), 
 BarsSince( Cross( MDI(Range), PDI(Range))) ));
 prevclose=Ref(Close,-bars);
 Com=EncodeColor(colorTan)+(\n\nCurrently the +DMI (+Range+) is +
 WriteIf(PDI(Range)  MDI(Range),bullish,bearish)+, and it crossed +
 WriteIf(PDI(Range)  MDI(Range),above,below)+ -DMI (+Range+) 
 .+\n+EncodeColor(colorAqua)+
 WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince( 
 Cross( MDI(Range), PDI(Range, 0.0)+
  period(s) ago.)+EncodeColor(colorTan)+
 Com=(\n\nSince the +DMI crossed -DMI, +Name()+ 's price has : 
 )+EncodeColor(colorGold)+\n+
 WriteIf(Closeprevclose,increased %,decreased 
 %)+WriteVal(100*(Close-prevclose)/prevclose)+
 EncodeColor(colorTan)+Com=(\n\nAnd has ranged from a high of +
 WriteVal(HHV(High,bars+1),6.2)+ to a low of 
 +WriteVal(LLV(Low,bars+1),6.2));
 Title = EncodeColor(colorWhite)+ ABS3 +  -  + Name() + 
 EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
  -  + Date() + - +\n +EncodeColor(colorYellow) +Op-+O+ 
 +Hi-+H+ +Lo-+L+ +
 Cl-+C+ + Vol= + WriteVal(V)+ Com;

 Thank you

 


 __ Information from ESET NOD32 Antivirus, version of virus 
 signature database 4627 (20091121) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com





 IMPORTANT PLEASE READ 
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links






  The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

Re: [amibroker] Re:Inverted (upside-down) chart display

2009-09-24 Thread cas soni

please try this..
//-

DF = -0.0003;
TC = C;
IC = 1 / ( C - DF );
IO = 1 / ( O - DF );
IL = 1 / ( H - DF );
IH = 1 / ( L - DF );

C = IC;
O = IO;
H = IH;
L = IL;
Plot( C,  , colorGrey40, styleCandle );
Title = Name() + :  + Last =  + TC;



--- On Thu, 24/9/09, Carl Vanhaesendonck carl@scarlet.be wrote:

From: Carl Vanhaesendonck carl@scarlet.be
Subject: [amibroker] Re:Inverted (upside-down) chart display
To: amibroker@yahoogroups.com
Date: Thursday, 24 September, 2009, 10:42 PM






 





  







What about turning your monitor upside down
? 

   

;-) 

   

Carl 

   







 

  




 

















  From cricket scores to your friends. Try the Yahoo! India Homepage! 
http://in.yahoo.com/trynew

Re: [amibroker] Re: Actual trade bar

2009-07-23 Thread cas soni
Hello everyone,
Below discussion is  very interesting , i would request  mike,broman1003 to 
please give/put full afl..as this is very confusing to me i cant get all this 
stuff in my little brain [ i am new to all this]*
Thank you
//-
--- On Fri, 24/7/09, Mike sfclimb...@yahoo.com wrote:

From: Mike sfclimb...@yahoo.com
Subject: [amibroker] Re: Actual trade bar
To: amibroker@yahoogroups.com
Date: Friday, 24 July, 2009, 2:39 AM






 





  Fredrik,



ProcessTradeSignals should come *after* you've done anything with the Signal 
objects. 



Also, you may need to double check whether you are allowed to mix 
ProcessTradeSignals (a mid level backtester method) with ExitTrade (a low level 
backtester method) in the same script.



It's been a while since I'be read up on this, so see AmiBroker Custom 
Backtester Interface.pdf in the Files section for additional detail.



Mike



--- In amibro...@yahoogrou ps.com, broman1003 fredrik_broman1003 @... wrote:



 Came up with a solution. If I use Foreign and get the High/Low/Open arrays 
 that way it works fine.

 /Fredrik

 

 --- In amibro...@yahoogrou ps.com, broman1003 fredrik_broman1003 @ wrote:

 

  Ok, so I had a go at it :-) Not sure that this is how you should do things 
  but it is my first attempt. The below code does not work because High[bar] 
  and Low[bar] allways returns zero. Hints?

  

  Thanks,

  /Fredrik

  

  SetOption(UseCusto mBacktestProc ,True);

  if( Status(action ) == actionPortfolio )

  {

   bo = GetBacktesterObject ();

   bo.PreProcess( );

  

   TradeEntryPrice = False;

   ProfitTarget = False;

   TrailingSL = False;

  

for(bar=0; barBarCount; bar++)

{

 bo.ProcessTradeSign als( bar );

  

 for( Sig = bo.GetFirstSignal( bar); Sig; Sig=bo.GetNextSigna l(bar) )

 {

  if( Sig.IsEntry( ) ) 

  { 

   TradeEntryPrice = Sig.Price;

   ProfitTarget = --something- --;

  }// if  

  

  if( Sig.IsExit() ) 

  { 

   TradeEntryPrice = False;

   ProfitTarget = False;

   TrailingSL = False;

  }// if

 }// for

  

 //Profit Target

 if (TradeEntryPrice AND High[bar]=ProfitTa rget)

 {

  bo.ExitTrade( bar,T5, Min(ProfitTarget, Open[bar] ), 2);

  TradeEntryPrice = False;

  ProfitTarget = False;

  TrailingSL = False;

 }

  

 

 //Calculate Trailing SL

 

  

 //Trailing SL

 if (TradeEntryPrice AND Low[bar]TrailingSL )

 {

  bo.ExitTrade( bar,T5, Min(TrailingSL, Open[bar] ), 3);

  TradeEntryPrice = False;

  ProfitTarget = False;

  TrailingSL = False;

 }

} //for

  

bo.PostProcess( ); // Finalize backtester

  } // if

  

  

  Buy = --- something ---

  Sell = --- something ---

  

  

  --- In amibro...@yahoogrou ps.com, broman1003 fredrik_broman1003 @ 
  wrote:

  

   Mike,

   Thanks, I'll have a go at it. I have managed to avoid using the customer 
   backtester up till now but I guess it is time well spent learning it..

   Cheers,

   /Fredrik

   

   --- In amibro...@yahoogrou ps.com, Mike sfclimbers@  wrote:

   

You can get the bar index of the trade by using ValueWhen and the 
trade's entry date as follows (from within custom backtester code):



bars = BarIndex(); 

dates = DateTime();

bo = GetBacktesterObject ();



...



for ( trade = bo.getFirstOpenPos( ); trade; trade = 
bo.getNextOpenPos( ) ) 

{ 

entryBar = LastValue( ValueWhen( trade.EntryDateTime == dates, 
bars ) ); 



 ...



There may be a better way of handling your stop loss, but the above 
should should at least answer your question.



Mike



--- In amibro...@yahoogrou ps.com, broman1003 fredrik_broman1003 @ 
wrote:



 Hi,

 I would like to get hold of the bar where a trade was entered when 
 backtesting.

 The reason I need it is that I would like to implement a trailing SL 
 that is depending on the highest value the price has hit since the 
 trade was initiated.

 

 All hints are appreciated.

 Thanks,

 /Fredrik



   

  

 






 

  




 

















  Looking for local information? Find it on Yahoo! Local 
http://in.local.yahoo.com/

Re: [amibroker] STO MA Slope - Code Problem

2009-05-07 Thread cas soni
Hello,
use this...it plots arrow on 50 level..i have checked ...

PlotShapes( shapeUpArrow * Buy, colorGreen, 0,50,0 );
PlotShapes( shapeDownArrow * Sell, colorRed, 0, 50,0 );

thank you
--- On Thu, 7/5/09, Anthony Faragasso ajf1...@epix.net wrote:

From: Anthony Faragasso ajf1...@epix.net
Subject: Re: [amibroker] STO MA Slope - Code Problem
To: amibroker@yahoogroups.com
Date: Thursday, 7 May, 2009, 5:52 PM
















  
  


Ken,
 
Check your formula... you have the 
following:

SetChartOptions(50, chartShowArrows); 
//What is the 50 for ? 
 
try putting it at the very top of your 
formula:
 
SetChartOptions( 0, chartShowArrows ); 
//Try this
 
every thing else below 
 
 

  - Original Message - 
  From: 
  Ken H 
  
  To: amibro...@yahoogrou ps.com 
  Sent: Thursday, May 07, 2009 8:14 
AM
  Subject: Re: [amibroker] STO MA Slope - 
  Code Problem
  

  
  
  


  
Hi Anthony
 
Using either option I can not see the arrows.
 
The code is now as follows:-
 
_SECTION_BEGIN( STO MA SLOPE);
myMA1 = MA(C,8);
SL=SlopeMA1 = 100*(myMA1- Ref(myMA1, 
-1))/myMA1;
HM=HHV(SL,120) 
;
LM=LLV(SL,120) 
;
STOSL=100*(SL- LM)/(HM-LM) 
;
Plot(STOSL, STOSL, colorDarkRed, 
styleThick) ; 
Plot(50, 
, 
colorBlue,styleNoLabel); 
_SECTION_END( ); 
 
_SECTION_BEGIN(TEMA); 
P = ParamField(Price field,-1); 
Periods = Param(Periods, 15, 
2, 300, 
1, 10 
); 
Plot( TEMA( P, 
Periods ), _DEFAULT_NAME(), ParamColor( Color, 
colorCycle ), ParamStyle(Style) ); 

SetChartOptions(50, chartShowArrows); 
Buy = Cross( 
STOSL,50); 
Sell = Cross( 50, STOSL ); 
PlotShapes( shapeUpArrow * 
Buy, colorGreen, 50, Close ); 

PlotShapes( shapeDownArrow 
* Sell, colorRed, 50, Close ); 

_SECTION_END(); 
 
Ken

--- On Thu, 7/5/09, Anthony 
Faragasso ajf1...@epix. net wrote:


From: 
  Anthony Faragasso ajf1...@epix. net
Subject: Re: 
  [amibroker] STO MA Slope - Code Problem
To: 
  amibro...@yahoogrou ps.com
Received: Thursday, 7 May, 2009, 
  9:57 PM


  
  
  
  Ken,
   
  There are a couple of ways.you can 
  right click in your chart and select Parameters  axis and grid 
   Miscellaneous  show trading arrows
   
  or add this line to the top of your 
  formula:
   
  SetChartOptions( 0, chartShowArrows 
  ); 
   
   
  Anthony
   
  
- Original Message - 
 
 
From: Ken H 
To: amibro...@yahoogrou 
ps.com 
Sent: Thursday, May 07, 2009 
7:49 AM
Subject: Re: [amibroker] STO MA 
Slope - Code Problem





  
  

  Hi Anthony
   
  The code now works however the Buy/Sell arrows are 
  not shown...  
   
  Can you suggest a solution for this?
   
  Many thanks for the assistance.
   
  Ken
   
  

--- On Thu, 7/5/09, Anthony Faragasso 
  ajf1...@epix. 
  net wrote:

  
From: 
Anthony Faragasso ajf1...@epix. 
net
Subject: Re: [amibroker] STO MA Slope - Code 
Problem
To: amibro...@yahoogrou 
ps.com
Received: Thursday, 7 May, 2009, 9:28 
PM






Buy = Cross( STOSL, 50); 
Sell = Cross( 
50 ,STOSL ); 

 
 
- Original Message - 
  
  From: 
  Ken H 
  To: amibro...@yahoogrou ps.com 
  
  Sent: Thursday, May 
  07, 2009 7:14 AM
  Subject: [amibroker] 
  STO MA Slope - Code Problem
  

  
  
  


  
Hi 
 
Can anyone correct the code below so that I can 
   

Re: [amibroker] Re: Multitime frame AFL What is the mistake

2009-04-07 Thread cas soni
Hello,
Please try this . i didnt check in amibroker but i think this will work.
 

 
TimeFrameSet( in5Minute*9) ;
StochK45=StochK( 14,3);
StochD45=StochD( 14,3,3);
TimeFrameRestore();
D45= TimeFrameExpand( StochD45, in5Minute*9);
k45=TimeFrameExpand( StochK45,in5Minute*9);
TimeFrameSet( in5Minute) ;
StochK5=StochK( 14,3);
StochD5=StochD( 14,3,3);
TimeFrameRestore( );
d5=TimeFrameExpand( StochD5 ,in5Minute);
k5=TimeFrameExpand( StochK5,in5Minute);
Buy=(K45 D45) AND Cross(K5, D5) ;
Sell=(D45K45) AND Cross(D5,K5) ;
Plot(k45,k45,colorGreen,1);
Plot(d45,d45,colorSeaGreen,1);
Plot(k5,,colorRed,1);
Plot(d5,,colorOrange,1);
PlotShapes(shapeUpArrow*Buy,colorGreen,0,20,0);
PlotShapes(shapeDownArrow*Sell,colorRed,0,80,0);
 
thank you

--- On Wed, 8/4/09, msc626 dalma...@sbcglobal.net wrote:


From: msc626 dalma...@sbcglobal.net
Subject: [amibroker] Re: Multitime frame AFL What is the mistake
To: amibroker@yahoogroups.com
Date: Wednesday, 8 April, 2009, 1:24 AM






TimeFrameSet( in45Minutes) = TimeFrameSet( 3*in15Minutes) = 
TimeFrameSet( 45*in1Minute) , etc

daleb
 I want a multi time frame scan but getting errors,Please let me know the 
 mistake
 
 TimeFrameSet( in45Minutes) ;
 
 StochK45=StochK( 14,3);
 StochD45=StochD( 14,3,3);
 TimeFrameRestore( );
 
 TimeFrameSet( in5Minute) ;
 
 StochK5min=StochK( 14,3);
 StochD5min=StochD( 14,3,3);
 TimeFrameRestore( );
 
 Buy=(StochK45 StochD45)  Cross(StochK5min, StochD5min) ;
 Sell=(StochD45 StochK45) Cross(StochD5mi n,StochK5min) ;
 
 Errors:
 
 1) it is showing syntax error for 45 mins
 
 2) When I scan I am keeping the settings for 5 mins then it is showing Cross 
 of 5 minutes stochastics  ignoring whether the 45 mins stochastics is above 
 or below it's trigger


















  Download prohibited? No problem. CHAT from any browser, without download. 
Go to http://in.webmessenger.yahoo.com/