Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-23 Thread Louis Préfontaine
Hi Thomas, Those links helped me a lot. Thanks! I still have some questions however. I now better understand the "for" statement, but could you please give me some precision on this? priceatbuy=0; highsincebuy = 0; exit = 0; for( i = 0; i < BarCount; i++ ) { if( priceatbuy == 0 AND

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-23 Thread Thomas Ludwig
> I don't understand what's the "i" for and why i++ (I know ++ is > suppose to mean that each number is added to the one before, but I am > not sure of how this code actually helps me). If someone could just > tell me what this thing is actually doing, it would really help me to > understand that

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Louis Préfontaine
Hi, Ok I am trying to experiment with stoploss and profittarget to try and understand how it works. Here is the example given in the help files: Buy = Cross( MA( C, 10 ), MA( C, 50 ) ); Sell = 0; // the system will exit // 50% of position if FIRST PROFIT TARGET stop is hit // 50% of position i

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Louis Préfontaine
Hi, I experimented with those, and found a bug I think.. Here is the code: // SetOption("UseCustomBacktestProc", False); // SetOption("MaxOpenPositions", 5 ); SetOption("InitialEquity", 10 ); SetOption("AllowPositionShrinking", True ); SetOption ("AllowSameBarExit", False); SetOption ("Activa

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Thomas Ludwig
Louis, the setoption syntax can be found in the manual or here: http://www.amibroker.com/guide/afl/afl_view.php?id=201 with references to examples in the AB library. Regards, Thomas > Hi, > > Unfortunately, I am not sure how to use this thing: > > // Set all options here: > > setoptions( 1 .

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Louis Préfontaine
Hi, Unfortunately, I am not sure how to use this thing: // Set all options here: > setoptions( 1 .); > setoptions(2. ) ; > setoptions(3. ) ; //etcetera > BuyPrice = SellPrice = Open;// or whatever you want > SetTradeDelays( 1,1,0,00; // etc. > > // Define Buy and Sell cond

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Thomas Ludwig
Louis, > Hi, > > Ok I think I understand... If I want to use custom values, I need to > build the code for the backtesting, and then I will have to click the > "Enable custom backtest procedure" button. I can't just use what's > there and add some things to it. No, you don't need custom backtest

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Louis Préfontaine
Hi, Ok I think I understand... If I want to use custom values, I need to build the code for the backtesting, and then I will have to click the "Enable custom backtest procedure" button. I can't just use what's there and add some things to it. So, basically, if I want to: 1) Change the % loss-st

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Thomas Ludwig
> The Help file will explain. > > Help > SetOptions > Help > BuyPrice > Help> Applystop > > The Help files are full of good examples of code. Indeed. And a nice framework for AB beginners can be found here: http://www.amibroker.com/library/detail.php?id=547 Regards, Thomas

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread ChrisB
The Help file will explain. Help > SetOptions Help > BuyPrice Help> Applystop The Help files are full of good examples of code. Regards ChrisB Louis Préfontaine wrote: > > Hi Chris, > > Thanks a lot for the explanation! Do you know where I could see some > example of this code? I mea

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread Louis Préfontaine
Hi Chris, Thanks a lot for the explanation! Do you know where I could see some example of this code? I mean, a complete code with all the ideas that you explained to me below? I learn a lot by modifying existing code and I am not sure what to do with " setoptions( 1 .);" as an example

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-22 Thread ChrisB
Louis In general if you use AFL to code stuff this overrides the Settings values (not always) Using the Settings values for Applystops is a great way to start. If you want to use the above code in your backtester formula just try something like this: // Set all options here: setoptions( 1

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-21 Thread Louis Préfontaine
Hi, Where exactly should I put this code? I am still a beginner and I feel confident about modifying the code for the charts and building a system with buy,sell, short and cover, but where should I put the information about this? I already can modify some variables with the "settings" button wit

Re: [amibroker] Changing the stop loss depending on the stock price?

2008-02-20 Thread ChrisB
Louis from a previous recent post by TJ > Hello, > ApplyStop( StopTypeNBar, stopTypeBars, IIF( Buy, 10, 5 ) ); > Best regards, > Tomasz Janeczko > amibroker.com and from the help files /amount/ = percent/point loss/profit trigger/risk amount. This could be a number (static stop level) or a

[amibroker] Changing the stop loss depending on the stock price?

2008-02-19 Thread louisprefontaine
Ok I got an easier question and I hope I'll be clear at first! ;-) I already use the stop/loss option at 10% stop. But I'd like to have a changing stop: Example: Close<10 // I'd like a stop of 10% Close>10 AND Close<35 //I'd like a stop of 5% Close>50 // I'd like a stop of 2.5% I think you get