Download Corti EA : https://cortiea.com
Why is EU correlated with Oil? 5 replies
who trades Correlated pairs? 0 replies
correlated pairs 2 replies
Pairs least correlated to GBP/JPY? 1 reply
The correlated arb/hedge-system 21 replies
Disliked{quote} How many Corti are here ? http://www.myfxbook.com/members/mast...ti-v33/7369811Ignored
DislikedSpiderWeb of profits with Corti v3.3 : https://macrofed.com/spiderweb-of-pr...th-corti-v3-3/Ignored
Thank you.
Disliked{quote} I have some questions : Trading time. - Broker/Local time? News On/Off some of them. - We can play also with news timing to check from 120 - 480 min. Entry Signal D1/M15 and H4/M15. - D1 has given more stable signals. Close on profit with fixed lot 0.02 and different Take Profit in equity like 4/5/6 . - with cvp 0.02 , is it good to use TP 6,7,8 ? Negative Correlation Limit to scan between -90 / -95 . - my feedback is stronger is better. Thank you.Ignored
DislikedSpiderWeb of profits with Corti v3.3 : https://macrofed.com/spiderweb-of-pr...th-corti-v3-3/Ignored
double calcMarginNeeded(string oSymbol, double oLots) {
/*
SYMBOL_CALC_MODE_FOREX Margin: Lots * Contract_Size / Leverage * Margin_Rate
SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE Margin: Lots * Contract_Size * Margin_Rate
SYMBOL_CALC_MODE_FUTURES Margin: Lots * InitialMargin * Margin_Rate
SYMBOL_CALC_MODE_CFD Margin: Lots * ContractSize * MarketPrice * Margin_Rate
SYMBOL_CALC_MODE_CFDINDEX Margin: (Lots * ContractSize * MarketPrice) * TickPrice / TickSize * Margin_Rate
SYMBOL_CALC_MODE_CFDLEVERAGE Margin: (Lots * ContractSize * MarketPrice) / Leverage * Margin_Rate
SYMBOL_CALC_MODE_EXCH_STOCKS Margin: Lots * ContractSize * LastPrice * Margin_Rate
SYMBOL_CALC_MODE_EXCH_FUTURES Margin: Lots * InitialMargin * Margin_Rate or Lots * MaintenanceMargin * Margin_Rate
SYMBOL_CALC_MODE_EXCH_FUTURES_FORTS Margin: Lots * InitialMargin * Margin_Rate or Lots * MaintenanceMargin * Margin_Rate * Margin_Rate
SYMBOL_CALC_MODE_EXCH_BONDS Margin: Lots * ContractSize * FaceValue * open_price * /100
SYMBOL_CALC_MODE_EXCH_STOCKS_MOEX Margin: Lots * ContractSize * LastPrice * Margin_Rate
SYMBOL_CALC_MODE_EXCH_BONDS_MOEX Margin: Lots * ContractSize * FaceValue * open_price * /100
*/
long calc_mode = SymbolInfoInteger(oSymbol,SYMBOL_TRADE_CALC_MODE);
//
double contract_size = NormalizeDouble(SymbolInfoDouble(oSymbol,SYMBOL_TRADE_CONTRACT_SIZE), _Digits);
double tick_size = NormalizeDouble(SymbolInfoDouble(oSymbol,SYMBOL_TRADE_TICK_SIZE), _Digits);
double tick_price = NormalizeDouble(SymbolInfoDouble(oSymbol,SYMBOL_TRADE_TICK_VALUE), _Digits);
double market_price = NormalizeDouble(SymbolInfoDouble(oSymbol,SYMBOL_BID), _Digits);
long leverage = AccountInfoInteger(ACCOUNT_LEVERAGE);
double initial_margin_rate;
double maintenance_margin_rate;
double margin = 0;
SymbolInfoMarginRate(oSymbol, ORDER_TYPE_BUY, initial_margin_rate, maintenance_margin_rate);
//
switch((ENUM_SYMBOL_CALC_MODE) calc_mode) {
case SYMBOL_CALC_MODE_FOREX:
margin = (oLots * contract_size) / (leverage) * initial_margin_rate;
break;
case SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE:
margin = oLots * contract_size * initial_margin_rate;
break;
case SYMBOL_CALC_MODE_FUTURES:
margin = oLots * initial_margin_rate * maintenance_margin_rate;
break;
case SYMBOL_CALC_MODE_CFD:
margin = oLots * contract_size * market_price * initial_margin_rate;
break;
case SYMBOL_CALC_MODE_CFDINDEX:
margin = (oLots * contract_size * market_price * tick_price) / (tick_size) * initial_margin_rate;
break;
case SYMBOL_CALC_MODE_CFDLEVERAGE:
margin = (oLots * contract_size * market_price) / (leverage) * initial_margin_rate;
break;
}
return margin;
} //--- return correllation coefficient
double correlation(double &arrX[],double &arrY[]) {
double meanX,meanY,stdX,stdY,numerator,ccoeff=0;
int length=ArraySize(arrX);
//---
meanX = 0;
meanY = 0;
stdX= 0;
stdY= 0;
numerator=0;
//---
if(ArraySize(arrY) != length) return(-2);
//---
meanX = mean(arrX);
meanY = mean(arrY);
//---
for(int i=0; i<length; i++)
{
numerator+=(arrX[i]-meanX)*(arrY[i]-meanY);
}
//---
stdX = std(arrX);
stdY = std(arrY);
//---
if(stdX*stdY*(length-1)>0) {
ccoeff=numerator/(stdX*stdY*(length-1));
}
//---
return(ccoeff);
};
//--- return standard deviation of a time series
double std(double &arr[]) {
double meanVal=0;
double std=0;
double length=ArraySize(arr);
//---
for(int i=0; i<length;i++)
{
meanVal+=arr[i];
}
//---
if(length>0)
meanVal/=length;
//---
for(int i=0; i<length; i++)
{
std+=MathPow(arr[i]-meanVal,2);
}
//---
if(length>0)
std=MathSqrt(std/length);
//---
return(std);
}
//--- return mean of a time series
double mean(double &arr[]) {
//---
double mean=0.0;
int length=ArraySize(arr);
//---
for(int i=0; i<length; i++)
{
mean+=arr[i];
}
if(length>0)
mean/=length;
//---
return(mean);
} DislikedMy belief is that instead of CVP a better approach is to calculate margin needed on-the-fly and therefore risk the exact amount of money on both trading instruments, below is the MQL5 sample code for this purpose (I know, I know, but it can be converted to MQL4 easily): double calcMarginNeeded(string oSymbol, double oLots) { /* SYMBOL_CALC_MODE_FOREX Margin: Lots * Contract_Size / Leverage * Margin_Rate SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE Margin: Lots * Contract_Size * Margin_Rate SYMBOL_CALC_MODE_FUTURES Margin: Lots * InitialMargin * Margin_Rate...Ignored
Disliked{quote} Brilliant thank you. Just out of interest does it only trade EUR/AUD and AUD/CHF? Thats all it has traded so far, all of which have been profitable.Ignored