Australian (ASX) Stock Market Forum

Amibroker coding questions

xxx

Joined
Oct 21, 2016
Posts
31
Reaction score
0
Hello,

I would like to code that if I got profit the month before I would like to invest 2 % of it in the next month.

Does anybody knows how I could programm this?

Thanks in advance.
 

xxx

Joined
Oct 21, 2016
Posts
31
Reaction score
0
PositionScore

Hello,

I have a question:
I would like to test if my score is bigger then 100.
If I write my code as followed:

test = score > 100;
PositionScore = IIf ( rotate, test, scoreNoRotate);

My result for PositionScore is 1 or 0. But I would like to get the number.

Could anyone help me?

thank you in advance
 
Joined
Jun 13, 2007
Posts
838
Reaction score
105
Re: PositionScore

This looks like an AmiBroker question. If it is, perhaps file it in that thread.

There is not much to go on to help you.

It looks like score is a variable with a range that can be both higher and lower than 100. Could the PositionScore be simply score? Or score - 100? Or score / 100?

Best, Howard
 

xxx

Joined
Oct 21, 2016
Posts
31
Reaction score
0
coding help

Hello,
I wrote a code for amibroker with rotational trading enabled. The system rotates monthly. Now I would like to add that the system rotates monthly but buys on the second trading day. My problem ist that I do not know how I could code this because of a monthly / daily clash ...

I would be very happy about help.
 

xxx

Joined
Oct 21, 2016
Posts
31
Reaction score
0
Re: PositionScore

Thank you for your answer. It works now.


This looks like an AmiBroker question. If it is, perhaps file it in that thread.

There is not much to go on to help you.

It looks like score is a variable with a range that can be both higher and lower than 100. Could the PositionScore be simply score? Or score - 100? Or score / 100?

Best, Howard
 
Joined
Aug 17, 2016
Posts
14
Reaction score
0
Hi All,


I’m starting to do some futures testing and looks for some help on position sizing. Is anyone able to point me to where I can find different position sizing methods for futures?


Specifically looking to be able to base the position size on risk parity i.e. calculate the number of contracts to buy = (0.001 x equity)/(ATR50 * PointValue).


The logic behind this is that multiplying the average true range by the point value of the specific futures contract results in how much profit/loss to expect from a normal days movements. Setting the risk factor to 0.001 meaning I’m willing to get an impact of 0.1% on my portfolio, and therefore need to multiply the risk factor with the portfolio equity to arrive at the daily impact in dollars. Then dividing this by the expected average impact of each contract fives the number of contracts to buy.


My understanding is that the calculation should look like this, however I’m having difficulty with the equity part of the equation.


Riskfactor = Param("Risk Factor",0.2,0.005,1,0.005);

Risk = (Riskfactor*Equity())/(Ref(ATR(50),-1) * PointValue);

PositionSize = Risk * MarginDeposit;

Any help is greatly appreciated.

Thanks,

James
 
Joined
Aug 17, 2016
Posts
14
Reaction score
0
Hi All,

The above works, if you can pull in the current portfolio equity value. I tested the system using 100000 as opposed to "Equity". Does anyone know how to pull in the current equity value? I've tried Foreign("~~~EQUITY","C"); but does not seem to work correctly.

Thanks!

james
 
Top