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

RE: [amibroker] Re: profit target question



PureBytes Links

Trading Reference Links

Code is processed one line at a time and never looks ahead. This means that
if you use the varibale "SELL" it must have been defined earlier - which you
didn't. You have to move the last 4 lines of your code ahead of everything
else. That is your basic system.
After that you use the ApplyStop().

IIt might be a good idea to work through the examples in help and writing
code. There are some basic programming rules that must be understood and
followed. It may take a few days but will save you lots of time later.

happy trading,
Herman.

-----Original Message-----
From: Adrian Zaremba [mailto:headcutter@xxxxxxxx]
Sent: Wednesday, August 20, 2003 7:46 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: profit target question


An error appears "missing buy/sell variable assignments"
and "Unknown identifier":

ApplyStop( 1, 1, 1, True, False ); /* Profit Target */
Equity(1);
Short = Sell == 3; // double == is EQUALITY check,
ShortPrice = SellPrice;
Equity(1);
Buy = Cross(MA(Close,5), MA(Close,12));
Sell = Cross(MA(Close,12),MA(Close,5));
Short = Sell;
Cover = Buy;


--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
<psytek@xxxx> wrote:
> The "==" is not an assignment but a comparsion, the code "Sell ==
3" returns
> a 1 if Sell equals 3. This is the case when AmiBroker has executed
a profit
> stop.
>
> So, in this case, when Sell equals 3 we assign a 1 to Short.
>
> The line of code you give in your email is incomplete and should
read:
>
> Short = Sell == 3;
>
> h
>
>
> -----Original Message-----
> From: Adrian Zaremba [mailto:headcutter@x...]
> Sent: Tuesday, August 19, 2003 2:56 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: profit target question
>
>
> An error message appears:
> Unknown identifier at line 4, column 15:
>
>
> --------------^
>
> I am not sure what the number 3 in this line is supposed to mean.
> What I want to do is enter an opposite trade when reaching profit
> target. So if I was long and reached profit target, I want to go
> short now. Thanks for help again.
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
<amibroker@xxxx>
> wrote:
> > Adrian,
> >
> > You are misuing assignment operator.
> > Your Short = Sell=3; simply ASSIGNED number 3 to BOTH sell and
> short variables
> >
> > If you want to check if given variable is EQUAL to some value you
> > have to use EQUALITY == operator
> >
> > ApplyStop( 1, 1, 1, True, False ); /* Profit Target */
> > Equity(1);
> > Short = Sell == 3; // double == is EQUALITY check,
> > ShortPrice = SellPrice;
> > Equity(1);
> >
> > Hope this helps.
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
>
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
> > > <psytek@xxxx> wrote:
> > > > You could use
> > > > Equity(1); // after the ApplyStop to update Signal and price
> > > arrays.
> > > > Short = Sell==3; // Profit stop was executed
> > > > ShortPrice = SellPrice; // The SellPrice you used before
(same
> bar)
> > > >
> > > > // You may need to call Equity(1) again to fix signal/price
> arrays
> > > >
> > > > You must enable "Allow same Bar Exits" in AA Settings
> > > and "Activate Stops
> > > > Immediately".
> > > >
> > > > Verify all prices in Trade Listings, this kind of stuff
> confuses
> > > me.
> > > >
> > > > Hope i got this right... Good luck,
> > > > Herman.
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Adrian Zaremba [mailto:headcutter@x...]
> > > > Sent: Monday, August 18, 2003 7:22 AM
> > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > Subject: [amibroker] profit target question
> > > >
> > > >
> > > > I use this code for profit target:
> > > >
> > > > ApplyStop( 1, 1, Optimize( "Profit Target", 1, 1, 15, 0.5 ),
> True,
> > > > False );
> > > >
> > > > The problem is that when the price reaches the profit target
> level
> > > > it exits the trade, but I would also want to enter a opposite
> trade
> > > > at the same time, so if I were long ,I want to go short. Can
I
> > > > modify this line in some way to make this work? Thanks
>
>
>
>
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html

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



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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