• Australian (ASX) Stock Market Forum

Hello and welcome to Aussie Stock Forums!

To gain full access you must register. Registration is free and takes only a few seconds to complete.

Already a member? Log in here.

Amibroker coding questions

Discussion in 'Software and Data' started by xxx, Nov 10, 2016.

  1. xxx

    xxx

    Posts:
    31
    Likes Received:
    0
    Joined:
    Oct 21, 2016
    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.
     
  2. xxx

    xxx

    Posts:
    31
    Likes Received:
    0
    Joined:
    Oct 21, 2016
    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
     
  3. howardbandy

    howardbandy

    Posts:
    838
    Likes Received:
    93
    Joined:
    Jun 13, 2007
    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
     
  4. xxx

    xxx

    Posts:
    31
    Likes Received:
    0
    Joined:
    Oct 21, 2016
    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.
     
  5. xxx

    xxx

    Posts:
    31
    Likes Received:
    0
    Joined:
    Oct 21, 2016
    Re: PositionScore

    Thank you for your answer. It works now.


     
  6. James Woods

    James Woods

    Posts:
    14
    Likes Received:
    0
    Joined:
    Aug 17, 2016
    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
     
  7. James Woods

    James Woods

    Posts:
    14
    Likes Received:
    0
    Joined:
    Aug 17, 2016
    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
     
Loading...

Share This Page