Hello i am new here. i have stock market experience but again new to amibroker. i was trying to adjust the position size but i could not do it. What i am trying to do is adjust the position size according to stop.
Stock price = $10000
Account capital = $10,000,000
Percent risk = 1% of account capital per trade = $1,00,000
Stop = 10 points.
Therefore position size = $1,00,000 / 10 pts = 10,000 shares per trade
i want to trade 10,000 shares at a time. How can we achieve this in backtest?
Stock buying price = $10,000
One more problem i am facing is that i have amibroker 1min data from 2011 till 2018. But when i run a backtest, it starts from April 2015 (even after selecting All Quotes). i have Amibroker 6.30 Professional. Do i have to change any settings to make it backtest on entire data?
i pasted the code line you gave me and it returned the following Trace log. Check attached screenshot
does 688861 bars mean the backtest is running on entire 1min data from 2011 till 2018? Yet it still shows results from 2015 till 2018. How to get it fixed
Coming back to my original question. Can we enter a value like
SetPositionSize(106, spsPercentOfEquity);
It seems too high number to test on 106% of equity for a 1% risk per trade in this case(Equity = $10,000,000). But that is the only solution i found to get it working. Point value = 75
Read the manual already pointed to you. You are not setting margin deposit (you should) and not following the manual http://www.amibroker.com/guide/h_futbacktest.html (if you are trading futures). Read slowly and carefully. Follow ALL steps. Don't skip.
Knowledge Base has everything you need. You might need to (re-)read it a couple of times. http://www.amibroker.com/kb/2014/10/12/position-sizing-based-on-risk/
This article already has ALL the explanations required, including calculations and all the math required. Nothing else beyond explicit and very detailed information already given in KB is available.
If you are getting PosSize of more than 100% it is obviously incorrect. You are supposed to do your math on your own. Again KB article has all the details.
Also you are once talking about stocks then you start talking about futures, so at this point no one really knows what you are after. You need to formulate your questions crystal clear, see: How to ask a good question
@dmbull9, welcome to the AmiBroker Forum. This is the DEEP end of a deep pool. AB is an amazing body of work and can do anything you can program it to do. Therein lies the problem: you have to know the programming environment in order to make it work.
Think of it like this: you go to a car dealership to buy a car. You pay your money and walk out with a car that drives. With AmiBroker, you're walking into the car factory and designing your own car. You need to know how to build the car but you can have it any way you want.
That's why you're being redirected to the User Guide and the Tutorials in nearly every reply. There is no shortcut, you have to study the material.
Thanks for your replies guys. i have spent the last few weeks in studying afl programming. Sometimes i get stuck. For e.g., i am not able to plot the sigscalein entries on the chart. How can it be done?
If i use If statement instead of sigscalein, then does amibroker consider both as same? What is the difference between both(if with loops for scalein or sigscalein)?
Hi @dmbull9,
I dont know about the backtest stuff but in PlotShapes(IIf(Buy==1 || Buy == sigScaleIn, shapeUpArrow ,Null),colorBlue, 0, H);
you should have a 'logical or' operator - OR.
In AFL | is 'bitwise or' and AFAIK || is not defined but may be valid - but other languages do use it.
@JohnHT AB has its roots deep inside C++ || and && are logical operators that are supported in AB (and do work) but the preferred convention tends to be OR and AND