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
AccountEquity & Price Per Pip functions or coding [SOLVED]
- 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]
Hello Fonz,
GetRTAccountEquity and GetRTCashBalance keywords should be helpful for you.Since the 2 functions "GetBDCashBalance" or "GetBDAccountEquity" don't work with MC, my 1st question is...
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;