stop loss and position sizing

Questions about MultiCharts and user contributed studies.
given81
Posts: 4
Joined: 06 Mar 2017

stop loss and position sizing

Postby given81 » 12 Mar 2017

Hi all

I would always a "standard" output in terms of $ from my trades, but I don't know how to translate this wish in MC code;

I try to explain better my needs: if I have a parametrical strategy, that for example enter at the high of daily bar setting stop loss at the low of the same bar, how can I adjust my position sizing in relation of the lenght of sl in order to optain always 100$ potential loss?

can you help me to translate this kind of position sizing in MC code?

thanks
regards

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: stop loss and position sizing

Postby Angelina MultiСharts » 14 Mar 2017

Hello given81,

Please contact us directly if you want this strategy to be written as a custom paid project.

given81
Posts: 4
Joined: 06 Mar 2017

Re: stop loss and position sizing

Postby given81 » 14 Mar 2017

angelina I think is not like a project: I m asking about a suggestion, I function to use, something like this... if I pay 1.400 $ for a software I would expect this kind of support

is not something too special

thx
antonio

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: stop loss and position sizing

Postby TJ » 14 Mar 2017

angelina I think is not like a project: I m asking about a suggestion, I function to use, something like this... if I pay 1.400 $ for a software I would expect this kind of support

is not something too special

thx
antonio

Angelina has always been above and beyond her duty to help users. If this is a simple question, she would have gone to the end of the World to help you. But honestly, this is a complex question. And furthermore, you have not actually laid out the requirements in a workable structure so that people can help you. What you have is only an abstract.

The quickest way to get help is to help yourself first. For example, you should post a schematic, a flowchart, or a logic drawings to illustrate your vision, then supplement them with some codes.

We can help you with syntax questions, or simple logic problems. Beyond the basics, you are looking at a project.

given81
Posts: 4
Joined: 06 Mar 2017

Re: stop loss and position sizing

Postby given81 » 15 Mar 2017

angelina I think is not like a project: I m asking about a suggestion, I function to use, something like this... if I pay 1.400 $ for a software I would expect this kind of support

is not something too special

thx
antonio

Angelina has always been above and beyond her duty to help users. If this is a simple question, she would have gone to the end of the World to help you. But honestly, this is a complex question. And furthermore, you have not actually laid out the requirements in a workable structure so that people can help you. What you have is only an abstract.

The quickest way to get help is to help yourself first. For example, you should post a schematic, a flowchart, or a logic drawings to illustrate your vision, then supplement them with some codes.

We can help you with syntax questions, or simple logic problems. Beyond the basics, you are looking at a project.

ok, fair enough

you are right, I lacked details and contextualization, but actually I thought this kind of position sizing is more common... my fault!
however, if you agree, I'm going to try to let you know what I need, then if it's impossible to give me some help... I'll evaluate a paid project.

let's try:
in my strategy I have this input (important assumption: don't think about standard contracts and standard lots; think about something like oanda unit, that allow to escalate positions):
MyContracts(100.000)

and this variable:
slLong(0)
slLong = HighD(0)

and then this order:
Buy("LE") MyContracts contracts Next Bar at maxSetup stop;

ok, now consider an example of entry point at 1,0600 eurusd and sl of 100 pips (0,0100):

- with this code, MC buy always 100.000 contracts (units in oanda terms) of eurusd, indipendently of the lengh of my sl --> the dollar value of sl would be: value of 1 pip * 100 pips --> 1 pip= 0,0001/1,0600*100.000= 9,434 --> 9,434*100= 943,40 euro of stop loss

- if I just want a "standard" loss of 100 euro on that position, my formula should be: 0,0001/1,0600*x*100=100 euro --> solving this equation, I'll have 10.600 units to buy in order to have a maximum loss of 100 euro on that position

so, hoping the situation is more clear now, what do you suggest to add? I imagine that "mycontracts" should became a variable itself, that depends of the lenght of sl, the standard loss that I want (100 euro in this example) and the pip value, but I don't know how to write the code of this new variable

please let me know if you can give me some suggestions

many thanks
regards

User avatar
Smoky
Posts: 507
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 97 times
Been thanked: 115 times

Re: stop loss and position sizing

Postby Smoky » 15 Mar 2017

Hi Given81,

We can help you, first you have to learn how post your code here, don't forget declaration part of your code, and if stategy run in Tick by tick what timeframe what bar you use ...

Maybe we can help you better with all informations ....

mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Re: stop loss and position sizing

Postby mickatrade » 16 Mar 2017

Hi given,

I had the same kind of issue when i started using MC.
The solution was to develop an interactive indicator for my discretionnary first.
Basically i have to CTRL+ click on the stop price level on the chart and it give me the right open size, tgt1 level + tgt1 size (outputs) based on my risk in eur per trade, riskreward and % size for tgt1 (inputs).
See the attached files.
Based on this logic , i also developped a strategy where the size of each trade is dynamic.
PM me if you want further details.

Regards
Attachments
discretionary2.PNG
parameters of indicator
(25.69 KiB) Downloaded 1038 times
discretionary1.PNG
indicator in action
(105.78 KiB) Downloaded 1038 times


Return to “MultiCharts”