Only selling when minimum profit achieved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #53132 quote
    soulintact
    Participant
    Senior

    Good evening!

    How do I express the following in a script for buying and selling stocks;

    1. “Only selling when minimum profit % achieved”. I thought it would be SET TARGET %PROFIT, but when I simulate it does not matter if I insert that function.

    2.  “That I spend a certain % of my Cash when I buy. I thought it would be “BUY 96% CASH ROUNDEDDOWN AT MARKET “, but I get error in code.

    Thanks in advance!

    Björn

    #53228 quote
    Nicolas
    Keymaster
    Master

    %PROFIT is in price percentage, not in percentage of your account. ProOrder has no way to know how much cash you have in your wallet if you not tell him first in a variable for instance. 

    You’ll have to make your own calculation of how much is 1% of price for the bought shares and then make a simple rule of 3 to set the target.

    You can calculate your money balance this way:

    // wallet is the amount of money of your account when you launch the strategy
    // the first time + the profit generated by the strategy currently running
    wallet = 10000 + STRATEGYPROFIT 

     

    soulintact thanked this post
    #53262 quote
    soulintact
    Participant
    Senior
    Than you very much for your prompt reply, even on a Sunday! Truly appreciated! Also a big thank you for a fantastic software and for all the opened code with different indicators, very helpful!!
    1. My wish of creating  a setting with a minimum of profit when selling the stocks is basically that do not want to sell with loss. Of course everyones dream, but I rather hold to the stock than selling it with loss. My previous script settings in another stock robot software was the following:
    //Mininum profit 1% min_profit:=1.010 profit=gt(c,mult(min_profit,lasttrade(b,p))) 2. In the same software I could set different in data variables for a certain stock, such as “stake”, for example -97 that would instruct the software to buy that certain stock with 97% of my money balance. That was very helpful as it enabled you to reinvest automatically the profits. Do note that it was in the settings of the software, not in the buy/sell script. Thanks for your time!
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Only selling when minimum profit achieved


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
soulintact @soulintact Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by soulintact
8 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/17/2017
Status: Active
Attachments: No files
Logo Logo
Loading...