AccountEquity & Price Per Pip functions or coding  [SOLVED]

Questions about MultiCharts and user contributed studies.
Fonz
Posts: 9
Joined: 07 May 2013
Has thanked: 7 times

AccountEquity & Price Per Pip functions or coding

Postby Fonz » 20 May 2013

Hi

Thank you for taking the time to read this topic.
I am trying to add a Money Management system to my strategy.

Since the 2 functions "GetBDCashBalance" or "GetBDAccountEquity" don't work with MC, my 1st question is: Is there a possibility to properly code something like "RiskDollar = AccBalance * RiskPercent" (I don't want to manually change every day the "AccBalance".. Stop the strategy, change, and automate again the strategy..

The 2nd question: I would like to code the Price Per Pip in US$ (Forex strategy) and being able to use it like:
If Symbol is GBPCAD then PPP = 0.0001 / GBPCADBid * 10000;
If symbol is USDJPY then PPP = 0.01 / USDJPYBid * 10000;

So an "easy" Money Management system could be:
RiskDollar = AccBalance * RiskPercent;
LotsQnty = (RiskDollar / PPP)*0.1);

If conditionLong then Buy LotsQnty contracts next bar at market;
if MarketPosition <> 0 then SetStopLoss( RiskDollar ) ;

Any advice?

Fonz

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: AccountEquity & Price Per Pip functions or coding  [SOLVED]

Postby Andrew MultiCharts » 20 May 2013

Hello Fonz,
Since the 2 functions "GetBDCashBalance" or "GetBDAccountEquity" don't work with MC, my 1st question is...
GetRTAccountEquity and GetRTCashBalance keywords should be helpful for you.
The 2nd question: I would like to code the Price Per Pip in US$ (Forex strategy) and being able to use it like:
If Symbol is GBPCAD then PPP = 0.0001 / GBPCADBid * 10000;
If symbol is USDJPY then PPP = 0.01 / USDJPYBid * 10000;

Code: Select all

Input: ForexPair1("GBPCAD"), ForexPair2("USDJPY");
Vars: PPP1(0), PPP2(0);
If symbolname = ForexPair1 then PPP1 = 0.0001 / CurrentBid * 10000;
If symbolname = ForexPair2 then PPP2 = 0.0001 / CurrentBid * 10000;


Return to “MultiCharts”