Enivid

Administrator
Staff member
Nov 30, 2008
12,263
481
114
Odessa
www.earnforex.com
I've uploaded a pre-release of a new version of Position Size Calculator to our GitHub repository.

The new version includes a fix of a small text glitch (introduced in 2.22) and makes calculations more accurate for cases when the currency pair's base currency is the same as the account currency.

I would really appreciate it if you download the new code (available in the pull request), test it and let me know if anything is broken. Thanks!
 
  • Like
Reactions: EnrichWave and jagg

Alexter

Active Trader
Jul 3, 2018
28
13
39
This happens because the IC Markets server returns profit currency for JP225 as JPY, however, in reality, it is in AUD, so the Position Size Calculator is calculating a size ~100 times greater than necessary. I am not sure how this can be solved from the indicator's code.
Hi @Enivid
Do you think this could ve solved by using something like MarketInfo(Symbol(), MODE_TICKVALUE) * SL (in points)

I am using that currently in some EAs and it has worked well for JP225 and the calcualted number is consistent with my universal google sheets calculator.

This is the code I use for my lot size in the EAs I work with. It may help.

_Lot_size = NormalizeDouble((((_Risk_per_trade / (100)) * AccountEquity()) / ((MarketInfo(Symbol(), MODE_TICKVALUE) * (_SL_pointns)) + _RT_Commission)) / _Number_of_trades_for_Split , LotDigits );

thanslated it basically is= $ Allowed to be risked per trade / $ money risked on a 1 lot (including commissions)
 

Enivid

Administrator
Staff member
Nov 30, 2008
12,263
481
114
Odessa
www.earnforex.com
Hi @Enivid
Do you think this could ve solved by using something like MarketInfo(Symbol(), MODE_TICKVALUE) * SL (in points)

I am using that currently in some EAs and it has worked well for JP225 and the calcualted number is consistent with my universal google sheets calculator.

This is the code I use for my lot size in the EAs I work with. It may help.

_Lot_size = NormalizeDouble((((_Risk_per_trade / (100)) * AccountEquity()) / ((MarketInfo(Symbol(), MODE_TICKVALUE) * (_SL_pointns)) + _RT_Commission)) / _Number_of_trades_for_Split , LotDigits );

thanslated it basically is= $ Allowed to be risked per trade / $ money risked on a 1 lot (including commissions)
Thanks for your suggestion, but the PSC's code already uses MarketInfo(Symbol(), MODE_TICKVALUE). The problem appears because the code then adjusts this tick value according to AUD/JPY conversion, which the code thinks is needed because the reported profit currency is JPY, whereas in reality the profit currency is AUD for JP225 at IC Markets. If I remove profit currency / account currency adjustment from the code, it will mess up all the legit cases when such adjustment is needed.
 

Alexter

Active Trader
Jul 3, 2018
28
13
39
Thanks for your suggestion, but the PSC's code already uses MarketInfo(Symbol(), MODE_TICKVALUE). The problem appears because the code then adjusts this tick value according to AUD/JPY conversion, which the code thinks is needed because the reported profit currency is JPY, whereas in reality, the profit currency is AUD for JP225 at IC Markets. If I remove profit currency / account currency adjustment from the code, it will mess up all the legit cases when such adjustment is needed.

I did check the code afterward and found that.

Interesting that you "correct" the tick value by the currency.

To my knowledge tick value should be in deposit currency so the broker should present it in AUD/EUR/GBP/HKD/USD in accordance to the account base currency and therefore the adjustment should not be necessary.

At least that is the theory based on mt4 documentation.

Is it really common that brokers don't display the TickValue properly in the deposit currency for some instruments?

Thanks as always for the great work and effort.
 

Enivid

Administrator
Staff member
Nov 30, 2008
12,263
481
114
Odessa
www.earnforex.com
I did check the code afterward and found that.

Interesting that you "correct" the tick value by the currency.

To my knowledge tick value should be in deposit currency so the broker should present it in AUD/EUR/GBP/HKD/USD in accordance to the account base currency and therefore the adjustment should not be necessary.

At least that is the theory based on mt4 documentation.

Is it really common that brokers don't display the TickValue properly in the deposit currency for some instruments?

Thanks as always for the great work and effort.
That would be correct for Forex trading instruments. But if we are talking about CFDs, the symbol's profit currency should be checked to calculate proper adjustment. You can check PSC on CFDs at other brokers (for example, RoboForex) and see that their TickValue is given in profit currency, not in account currency.
 

Alexter

Active Trader
Jul 3, 2018
28
13
39
That would be correct for Forex trading instruments. But if we are talking about CFDs, the symbol's profit currency should be checked to calculate the proper adjustment. You can check PSC on CFDs at other brokers (for example, RoboForex) and see that their TickValue is given in profit currency, not in account currency.
Interesting.

So I guess its more about how brokers report things to MT4 and config and it will change from broker to broker as some may use the deposit currency while others the instrument currency for the things. I'll be careful when trading CFDs that are not currencies or metals. ICMarkets, as well as Pepperstone, reported to my EA (to what I can see) the tick value as deposit currency, but it seems other brokers do it differently.

So the solution would have to be at a personal level, maybe a toggle could be used for the CFD adjustment or use the reported tick value.
That way if the broker reports thigns"correctly" (per MT4 specifications which would be Tick value properly in deposit currency) the user can use the "standard" version and if the broker reports differently the user could use the adjust function you have built in to correct those issues.

Do you think this could be a viable solution that would work for most people? (I am also trying to avoid having you make a "general" release version and a CFD version as I think that could mean more work on your side and honestly with all the great work and things you have doing I think your time is really valuable)

Let me know if there are other ways in which I could help (besides ideas and spreading the word to others about the awesome tools here)
 

Enivid

Administrator
Staff member
Nov 30, 2008
12,263
481
114
Odessa
www.earnforex.com
So the solution would have to be at a personal level, maybe a toggle could be used for the CFD adjustment or use the reported tick value.
That way if the broker reports thigns"correctly" (per MT4 specifications which would be Tick value properly in deposit currency) the user can use the "standard" version and if the broker reports differently the user could use the adjust function you have built in to correct those issues.
I will probably do it this way if I don't find a better solution.
 

Cliff Jaded

Trader
Aug 29, 2019
2
1
18
31
Singapore
Hi, I have been a faithful user of PSC for a few years now and it has been invaluable to me trading and backtesting.

I have a suggestion. I use PSC inconjuction with Fibonacci to set the levels for Stoploss, Entry and Take Profit.
Because I trade the M5 and M1 timeframes, moving / typing the levels manually can be too slow at times.

My suggestion is an option to align the levels automatically to Fibonacci levels. Those levels could be set through PSC options.
Another suggestion would be to add a button that adds a configurable number of points to the Stoploss in order to factor in spread / wiggle room.|

2 pictures to illustrate my suggestion. It's just a suggestion for your humble consideration. Thank you :)
 

Attachments

  • Like
Reactions: Enivid

Enivid

Administrator
Staff member
Nov 30, 2008
12,263
481
114
Odessa
www.earnforex.com
Hi, I have been a faithful user of PSC for a few years now and it has been invaluable to me trading and backtesting.

I have a suggestion. I use PSC inconjuction with Fibonacci to set the levels for Stoploss, Entry and Take Profit.
Because I trade the M5 and M1 timeframes, moving / typing the levels manually can be too slow at times.

My suggestion is an option to align the levels automatically to Fibonacci levels. Those levels could be set through PSC options.
Another suggestion would be to add a button that adds a configurable number of points to the Stoploss in order to factor in spread / wiggle room.|

2 pictures to illustrate my suggestion. It's just a suggestion for your humble consideration. Thank you :)
Thanks for your suggestion! I will consider adding it in the next version of the PSC, but I am not sure if that's even possible (detection of Fibo levels) without adding lots of input parameters to the indicator.
 

Cliff Jaded

Trader
Aug 29, 2019
2
1
18
31
Singapore
I'm no MQL4 maestro, i did take a look at documentation and it doesn't seem very easy to do.

But I do think a configurable points box that can be added to the stoploss will come in handy.

E.g. Stop Loss = 1.6
Buffer = 1.0
True Stop Loss = 2.6

An option to add spread also would be handy. This would come in super handy in scalping situations at M5 / M1 time frames when there's little time to react yet precision is still important. Just something to think about.

As it is, PSC is still a core of my trading and I share with it all my friends. I could never go back to entering trades manually again! In fact, I don't think I ever did on MT4.
 

Alexter

Active Trader
Jul 3, 2018
28
13
39
I will probably do it this way if I don't find a better solution.
Yea, that is true. The main issue is the inconsistency in data reported by brokers as this is a universal tool. Brokers should report things properly per the documentation (in deposit currency) but not all do, which causes these issues.



I'm no MQL4 maestro, I did take a look at the documentation and it doesn't seem very easy to do.

But I do think a configurable points box that can be added to the stop loss will come in handy.

E.g. Stop Loss = 1.6
Buffer = 1.0
True Stop Loss = 2.6

An option to add spread also would be handy. This would come in super handy in scalping situations at M5 / M1 time frames when there's little time to react yet precision is still important. Just something to think about.

As it is, PSC is still a core of my trading and I share with it all my friends. I could never go back to entering trades manually again! In fact, I don't think I ever did on MT4.
The fibos is really hard to do as there would need to be rules to auto-generate the fibos and so on. At that point its a lot easier to just plot them based on your rules and move the SL line to the one you need (as you will not always choose 1 line, you most likely will select different fibo line for different situations)

For the "Buffer" I don understand the purpose as this can be easily done manually when inputting the SL in points/ pips.

I think the adding the spread to the SL value could be really valuable, especially for scalping, but even for swing traders as many of us do add the spreads in our own algos. Honestly, I never thought of asking this to Enivid as I just moved my SL a bit larger based on the spread at that time naturally for my day trading.

Good suggestions.
 

Michael618

Trader
Jul 20, 2017
16
6
24
40
i had a small idea, while playing around with PSC indicator.

I was thinking about some risk:reward thing/idea
and while changing the SL line, I expected to see TP line updating itself automatically (instead of hitting Take-profit button)

Initially i thought it would be good to keep TP in sync with SL line (when SL is modified)
But after more thought, i think it would be great to have a checkbox there (to the right of TP text input price)
To keep TP line in sync with SL line (only when SL is modified? or always? i'm not sure about this)

This would be great for all traders who have a fixed TP strategy, and they want to adjust the SL only.
(maybe it's possible even now, but i didn't find a way to keep TP in sync with SL modification)

what do you think?
 

Enivid

Administrator
Staff member
Nov 30, 2008
12,263
481
114
Odessa
www.earnforex.com
Thanks for the idea, @Michael618! The problem is that I am not convinced that this is a right thing to add. First, having a fixed SL/TP distance disregarding the chart/fundamental situation is usually a destructive technique to employ. Second, adding a checkbox without any text would be very much confusing to traders while adding a description would clutter the panel, which is already very cluttered. Third, it is not really a big deal to click a TP button, which was designed with this purpose too.
 
  • Like
Reactions: Michael618