Preciso de uma ajuda de outro Programador para meu projeto pessoal Assunto(Money Manager)

指定

Caro desenvolvedor, eu estou elaborando um gerenciamento de risco e estou travado em alguns pontos nesse gerenciamento, gostaria de um suporte de um colega programador para me ajudar a desenvolver com a formula que gostaria a logica é a seguinte                                                                                                                                                                                                            double MM_Size()  // martingale / anti-martingale
{
    double SL;
// Assumindo que a lógica para determinar StopSell e StopBuy já foi definida em algum lugar
if (ORDER_TYPE_BUY) {
    SL = ATR2[Shiftatrbuystop] * StopBuy;  // Stop Loss = Average True Range * fixed value
} else {
    SL = ATR4[ShfitStopatrSell] * StopSell;  // Stop Loss = Average True Range * fixed value
}

    double tickvalue = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE);
    double ticksize = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_SIZE);
    double lots = MM_Percent * 1.0 / 100 * AccountInfoDouble(ACCOUNT_BALANCE) / (SL / ticksize * tickvalue);
    double MaxLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MAX);
    double MinLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN);
    ulong ticket = 0;
   
    if ( ORDER_TYPE_BUY) {
        ticket = LastBuyOrderTicket();
    } else {
        ticket = LastSellOrderTicket();
    }

    if (ticket > 0) {
        double lastDealVolume = HistoryDealGetDouble(ticket, DEAL_VOLUME);
        double lastDealProfit = HistoryDealGetDouble(ticket, DEAL_PROFIT);
        
        if (lastDealProfit > 0 && !MM_Martingale_RestartProfit) {
            lots = lastDealVolume * MM_Martingale_ProfitFactor;
        } else if (lastDealProfit < 0 && !MM_Martingale_RestartLoss) {
            lots = lastDealVolume * MM_Martingale_LossFactor;
        } else if (lastDealProfit == 0) {
            lots = lastDealVolume;
        }
    } else 
   
     if(ConsecutivePL(false, MM_Martingale_RestartLosses))
      lots = MM_Percent * 1.0 / 100 * AccountInfoDouble(ACCOUNT_BALANCE) / (SL / ticksize * tickvalue);
   if(ConsecutivePL(true, MM_Martingale_RestartProfits))
      lots = MM_Percent * 1.0 / 100 * AccountInfoDouble(ACCOUNT_BALANCE) / (SL / ticksize * tickvalue);
   if(lots > MaxLot) lots = MaxLot;
   if(lots < MinLot) lots = MinLot;
   return(lots);
}                                                                                                                                                                                                                                                                                                               //Quero que ela aplique os stops de maneira correta pois me parece que nao esta sendo calculado corretamente por ter 2 tipos de stops, quero que o martingale seja aplicado somente no tipo de ordem ou seja Buy aplica martingale somente Buy, Sell somente Sell... Reiniciar o loop somente se o profit Atual bateu todas as sequencias de loss de determinado Tipo de ordem 


反馈

1
开发者 1
等级
项目
0
0%
仲裁
1
0% / 100%
逾期
0
空闲
2
开发者 2
等级
(50)
项目
51
8%
仲裁
0
逾期
0
空闲
3
开发者 3
等级
(11)
项目
17
59%
仲裁
2
0% / 100%
逾期
2
12%
空闲
4
开发者 4
等级
项目
0
0%
仲裁
0
逾期
0
空闲
相似订单
Vamos aprender a operar no mercado Forex vamos aprender vamos trabalhar no mercado Forex vamos temos tudo para dar certo só trabalho só com trabalho podemos fazer tudo para nossa vida

项目信息

预算
33+ USD