Davide92 Posted April 1, 2021 Report Share Posted April 1, 2021 Hello Jerry, I would like to ask you if it is possible to set a desired transaction value, so that each time that an order is placed, the number of shares reflects the desired transaction value. For example: For Example: - Desired Transaction Value: 5000$ - Stock Price: 5$ - The Trading capsule (if market order) is already set to 1000 shares. Or if alternatively, I wanna place a limit order at 4.80$ the trading capsule would automatically update to 1040 shares. I have seen there is this option (photo below). But when I then try to place an order on the chart, the default quantity in the trading capsule does not reflect the transaction value required. Thank you very much for your help Davide Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted April 1, 2021 Report Share Posted April 1, 2021 that is not available - the account level setting is applied at the time the trade ticket is loaded, or in case of charts, at the time symbol is loaded Quote Link to comment Share on other sites More sharing options...
Davide92 Posted April 2, 2021 Author Report Share Posted April 2, 2021 Thanks for the reply Jerry. Would it possible to have an indicator that shows the level of shares to buy given these three variables: - Desired Trasaction Value - Maximum Amount Willing to Lose - Risk, expressed maybe as a percentage So the formula to calculate the position size would be Maximum Amount Willling to Lose / Risk % (applied to the price of the stock). For example: Current Price: 5$ Maximum Amount WIlling to Lose: 250$ Risk%: 5% This would give a Number of shares to buy equal to 1000. Is it possible to create a similar indicator to put on the chart? Thank you for your response Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted April 2, 2021 Report Share Posted April 2, 2021 You could make a paintbar that calculates this. Simple code like this var MaxLoss = 250; var RiskPercent = 5; var Amt = Math.Floor(MaxLoss / (RiskPercent*0.01) / Close); SetColor(Color.Yellow); SetYValue(Amt); Then show the paintbar on the bottom chart. Quote Link to comment Share on other sites More sharing options...
Davide92 Posted April 2, 2021 Author Report Share Posted April 2, 2021 Thank you very much Mike. I try do it. I really appreciate your support Quote Link to comment Share on other sites More sharing options...
Davide92 Posted April 2, 2021 Author Report Share Posted April 2, 2021 Mike, I am not an expert in coding. I have tried to paste the formulas you gave me in the advanced paintbar, but it gives me the following error Would you be able to help me? Thank you Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted April 2, 2021 Report Share Posted April 2, 2021 when MT converted a simple paintbar to advanced, it had the Main function declaration. Seems that you removed it. It is required Quote Link to comment Share on other sites More sharing options...
Davide92 Posted April 2, 2021 Author Report Share Posted April 2, 2021 This is the screenshot that I get when swithcing to Advanced Paintbar, from simple Where should I put the code? Thanks Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted April 2, 2021 Report Share Posted April 2, 2021 delete the if (.... ; // ... and put your code there instead. Quote Link to comment Share on other sites More sharing options...
Davide92 Posted April 2, 2021 Author Report Share Posted April 2, 2021 Thank you Jerry Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.