Purchase a specific dollar value worth of a stock/equity

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #238923 quote
    JoshPhoenixJoshPhoenix
    Participant
    New

    Hey all,

     

    Is it possible to code an algo to purchase a specific $$ amount of a stock, vs hardcoding the number of shares?

    eg if a stock is trading at $500 and to want to purchase $2000 worth of it, the number of stocks would be 4. if a stock was trading at $250, it would be 8 shares.

    #238926 quote
    JSJS
    Participant
    Master

    Hi,

    You can use the following:

    If BuyConditions then

    Buy 2000 Cash

    EndIf

    JoshPhoenix and Iván González thanked this post
    #238937 quote
    JoshPhoenixJoshPhoenix
    Participant
    New
    Great, thanks 🙂
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Purchase a specific dollar value worth of a stock/equity


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by JoshPhoenixJoshPhoenix
1 year, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/13/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...