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

[amibroker] Re: Plse help! APPLYSTOP() and BUYPRICE, SELLPRICE



PureBytes Links

Trading Reference Links


Isn't the price at the crossing point = Close?

Such that:
Buy = Cross(Close, EMA(Close, 20));
BuyPrice = Close;

I'm assuming that you want to Buy when the Close moves ABOVE the 
EMA.  Your code below is the opposite - Buy when Close moves BELOW 
the EMA.

--- In amibroker@xxxxxxxxxxxxxxx, "zillig20002000" <anietrade@xxxx> 
wrote:
> 
> 
> 
> S imularQuestion:
> BuyPrice=Cross(  EMA(Close,20),Close ) ;
> 
> This decribes the low of the day. But I want the price at the 
> crossing- point. Can someone help me?
> 
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Christoper" <turkey@xxxx> wrote:
> > 
> > Ah ok... so I dont' think the Applystop is what you want.
> > 
> > Try this:
> > Sell = <see conditions>;
> > Sell = Sell or C < Highestsince( Buy, StopPriceArr, 1);
> >                ^-You can chagne this value to what you want.  I 
> > assume this is EOD system.
> > 
> > - chris
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "enzo" <herrfrechdax@xxxx> 
wrote:
> > > 
> > > hi christoper!
> > > 
> > > I coded a little function to write arrays in .xls files and 
open 
> > > them using Excel. So I am sure about the contents of arrays. I 
> dont 
> > > plot them.
> > > 
> > > An example for ^DJI the last buy-signal occurred 28/10/2004, 
the 
> > > system would buy ^DJI at next open 10004,70. Last SwingLow was 
> > > 9660,18. This would be my StopLoss. All testdata are EOD from 
> Yahoo-
> > > historical.
> > > 
> > > The system is so to say simple: when I have a buy, I use the 
last 
> > > SwingLow as Stop and turn the position. I have all the 
> information 
> > > in arrays but dont know how to code APPLYSTOP() to set 9660.18 
as 
> > my 
> > > sellstop. 
> > > 
> > > The arrays:
> > > 
> > > myBuySignal: row 605 = 1
> > > BUY: row 605 = 1
> > > BUYPRICE: row 605 = 9888.25 (the open of the 28/10/2004
> > > SellStopArr: row 605 = 9660.18 (last SwingLow)
> > > 
> > > 
> > > You see, the information in row 605 in BUYARRAY is wrong, 
because 
> I 
> > > buy on next open, it should be 10004,70, which is in row 606.
> > > 
> > > 
> > > 
> > > for your convinience the function to write array in Excel files:
> > > 
> > > //************************************************/
> > > function PrintArray1 (array,arrName)
> > > //************************************************/
> > > {
> > > fh = fopen( "c:\\programm 
> > > Files\\amibroker\\afl\\"+"___"+arrname+".xls", "w"); 
> > >    for( i = 0; i < BarCount; i++ ) 
> > >    	{ 
> > > 		ds = StrFormat("%g.-%g.\n", i, array[ i ]);
> > >       	fputs( ds, fh ); 
> > > 	} 
> > > 	fclose( fh ); 
> > > }
> > > 
> > > Call example: 
> > > printarray1(Buy,"Buy");
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Christoper" <turkey@xxxx> 
> wrote:
> > > > 
> > > > 1 - Have you plotted the StopPriceArr to know that this is 
> > > correct?  
> > > > Or is it changing each bar, such that the stop is always 
> > > fluctuating 
> > > > and the price will never trigger it.  You might need 
something 
> > > like 
> > > > StopPriceArr = HighestSince(Buy, StopPriceArr, 1) to kinda 
lock 
> > in 
> > > > the trail.
> > > > 
> > > > 2 - If you are trying to plot the stop you may need to utilize
> > > > Equity(1); somewhere in your code.
> > > > 
> > > > I might not understand your system too well, so perhaps 
> > additional 
> > > > clarification might help...
> > > > 
> > > > - chris
> > > > 
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "enzo" <herrfrechdax@xxxx> 
> > wrote:
> > > > > 
> > > > > Hello!
> > > > > 
> > > > > some days ago I asked for help, how to use APPLYSTOP() to 
> turn 
> > a 
> > > > > position when a CLOSE crossed a certain stop which is 
defined 
> > as 
> > > a 
> > > > > price. It looks like this is not possible!? 
> > > > > 
> > > > > So I thought I could use the difference between the payed 
> price 
> > > and 
> > > > > the stop-price and use APPLYSTOP() with Mode=2
(stopTypeLoss) 
> > > type=2
> > > > ( 
> > > > > amount in points) amount=calculated difference in points. 
> > > > > 
> > > > > Would someone confirm this is the right way to do?
> > > > > 
> > > > > For the payed price I would use arrays BUYPRICE and 
> SELLPRICE, 
> > > but 
> > > > I 
> > > > > have found out, they are exactly similar to the OPEN price 
of 
> > > the 
> > > > > day (or bar) the buysignal occurred. Even I set 
SetTradeDelays
> ( 
> > > 1, 
> > > > > 1, 1, 1 ) ; Why does BUYPRICE and SELLPRICE not reflect the 
> > real 
> > > > > payed price? Do I have to create correct BUYPRICE and 
> SELLPRICE 
> > > > > arrays by myself?
> > > > > 
> > > > > Thanx for any suggestions,
> > > > > 
> > > > > enzo
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "enzo" 
<herrfrechdax@xxxx> 
> > > wrote:
> > > > > > 
> > > > > > Hello usergroup!
> > > > > > 
> > > > > > In my AITM trading-system buy- and sell-signals are 
> generated 
> > > at 
> > > > > > CLOSE and executed at next open. Stops are set at the 
last 
> > > > > > SwingHighs/-lows before the signal occurred. Those 
SH/SH´s 
> > are 
> > > > > > written in an array "StopPriceArr". A close beyound/below 
a 
> > > stop 
> > > > > > should turn the position and be executed at next open. 
> > > > > > Can someone help me to code the stops?
> > > > > > 
> > > > > > 
> > > > > > So far I coded:
> > > > > > 
> > > > > > SetTradeDelays( 1, 1, 1, 1 ) ;
> > > > > > SetOption("ActivateStopsImmediately",True); 
> > > > > > .
> > > > > > .
> > > > > > .
> > > > > > BUY=BuyCondition;
> > > > > > SELL=SellCondition;
> > > > > > ApplyStop(0,2,StopPriceArr,2);
> > > > > > Short = Sell;
> > > > > > Cover = Buy;
> > > > > > 
> > > > > > 
> > > > > > It seems it is not working as I expected and actually I 
am 
> > not 
> > > > > > surprised by it, cause I cannot make a sense of the 
> > > combinations 
> > > > > of 
> > > > > > ApplyStop-paramaters.
> > > > > > 
> > > > > > Can you?
> > > > > > 
> > > > > > Thanx in advance
> > > > > > enzo





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/