Log in or register to download unlimited Forex robots!
Martingale um pouco diferente.
Ja faco uso do robo Ilan 1.6 conhecido por muitos.
Quero acrescer um martingale um pouco diferente.
Estou tentando por uma so funcao martingale, tanto para lucro quanto para percas. Valores dessa funcao serao recebidos como parametros.
Dentro dessa funcao global de martingale teremos as opcoes de gale_lucro e gale_perca, sendo essas variaveis externas do tipo bool, pois quero ter a opcao de habilitar ou nao. Podendo trabalhar separadas, as duas juntas, ou ate as duas desabilitadas.
Ja criei o codigo mas nao funciona quando as duas as opcoes gale_lucro e gale_perca estao marcadas como true.
Preciso que uma unica variavel receba os valores dessa funcao martingale. Ver imagem em anexo.
A ideia e que na funcao start (), quando chamado o OrderSend , campo referente a lote seja colocado essa variavel que ja possui a logica do gale_lucro ou gale_perca.
Gale_lucro : criar limitador de quantidade como uma variavel externa
Gale_perca : criar limitador de quantidade como uma variavel externa
.........................................................
Exemplo de funcionamento do robo:
Considera-se habilitadas as opcoes de gale_lucro e gale_perca.
Lote inicial 0.01
1 operacao profit < 0 - [ gale-perda] Essa funcao ira multiplicar pelo fator multiplicador ( variavel externa ex. 1.4 ) e fazer o calculo.
2 operacao profit < 0 - a funcao gale-perda tera um limite de operacoes, ex. ate lote <= 20 e recomeça o ciclo do gale-perca
3 operacao profit > 0 - lote retorna ao lote inicial 0.01
4 operacao profit > 0 - [ gale-lucro] Essa funcao ira incrementar pelo fator ( variavel externa ex. 0.01 ) e fazer o calculo 0.01+0.01.
5 operacao profit > 0 - a função gale_lucro tera um limite de operaçoes ex. ate lote 0.03. Nesse ex aqui sera calculado 0.02+0.01
6 operacao profit > 0 - lote incrementa chega no limitador, pois ja alcancou o lote 0.03.
7 operacao profit > 0 - lote retorna ao lote inicial 0.01
8 operacao profit > 0 - [ gale-lucro]
9 operacao profit < 0 - [ gale-perda]
Deixo abaixo a funcao por mim escrita, peco orientacao quanto ao que estou errando, desde ja agradeco.
duplo martingala ( duplo lote_inicial , duplo fator_incremento , duplo fator_aumento , int Magicma_n ) {
/ * lote_inicial = 0 , 01 , fator_incremento = 1 , 4 , fator_aumento = 0 , 01 * /
tamanho_lote duplo = 0 ;
int maior_ticket = 0 ;
lote duplo = 0 ;
double maior_lote = 0 ;
lucro duplo = 0 ;
para ( int i = 0 ; i < OrdersHistoryTotal ( ) ; i ++ )
{
if ( OrderSelect ( i , SELECT_BY_POS , MODE_HISTORY ) == false )
break ;
if ( ( OrderSymbol ( ) == Symbol ( ) ) && ( OrderMagicNumber ( ) == Magicma_n ) ) // verifica a moeda, qual robô
{
if ( OrderTicket ( ) > maior_ticket )
{
maior_ticket = OrderTicket ( ) ;
maior_lote = NormalizeDouble ( OrderLots ( ) , 2 ) ;
lucro = OrderProfit ( ) ;
}
}
}
if ( OrderSelect ( maior_ticket , SELECT_BY_TICKET , MODE_HISTORY ) == false )
return ( lote_inicial ) ;
if ( maior_lote == 0 )
tamanho_lote = lote_inicial ;
// -------------
if ( ( gale_perca == false ) && ( gale_lucro == false ) ) {
if ( ( lucro > 0 ) || ( lucro < 0 ) )
tamanho_lote = lote_inicial ;
}
if ( ( gale_perca == false ) && ( gale_lucro == true ) ) {
if ( profit > 0 )
tamanho_lote = maior_lote + fator_lot ; //
else if ( profit < 0 ) tamanho_lote = lote_inicial ;
}
if ( ( gale_perca == true ) && ( gale_lucro == false ) ) {
if ( profit < 0 )
tamanho_lote = maior_lote * fator_incremento ; //
else if ( profit > 0 ) tamanho_lote = lote_inicial ;
}
// ----------------------------------------------- ------------------- //
if ( ( gale_perca == true ) && ( gale_lucro == true ) ) {
if ( lucro < 0 ) {
if ( lote_inicial == loteentrada ) {
tamanho_lote = maior_lote * fator_incremento ;
if ( lucro > 0 ) tamanho_lote = lote_inicial ;
}
}
// ----------------------------------------------- --------------------
if ( lucro > 0 ) {
tamanho_lote = lote_inicial ;
if ( tamanho_lote == lote_inicial )
tamanho_lote = tamanho_lote + fator_lot ;
if ( lote_inicial ! = loteentrada ) {
tamanho_lote = maior_lote + fator_lot ;
if ( lucro < 0 ) tamanho_lote = maior_lote * fator_incremento ;
if ( lucro > 0 ) tamanho_lote = lote_inicial ;
}
}
}
lote = NormalizeDouble ( tamanho_lote , 2 ) ;
return ( lote ) ;
}
- Total number of registered users: 77,563
- Registered users today: 5
- Newest registered user: Thucy2023
- Total number of topics: 11,778
- Total number of posts: 38,458
Online users: 2,799 guests, 80 Members:
Abdullah Alramzi, admin, Anthony258, Asbu, aussiesteve, azfxtrade, Biren, Brasky4eva, brunox, BUNDER, cowboy25, Daniel Higgins, Dayyaan Williams, defipro, diversanta, doleinan, DRIIYKy, edwinses, emmie789, Eric Uzor, fahmiop, fari stp, farry, fastlane2021, fjohnny, flairandflowers, Gerard Collins, ghfxwealth, gohang, gr8adroit, guska, hgmt4, hhh45, Higor Asano, IamSolomonChika, igiepascua, Investor, Joshua Allison, Justin Schmitgen, justinayu, Khunmon, kibewilly, KKH, Labas, Lars Dalgren, Luisbia, MARGARETKIRKLAND19, marketingwithmark, MartinK, masterpieces86, Mathanes Uchenna FHemanaq I, Mendocino, moneyjolt, Mostafa Moaseri, mt4talk001, neagoelaur, nkosinathi_mkondwane, Oupas25, phgja1, pigboy, Purgeaudio, Rosecharity40, Santiago, sasastephe, Simone Cik Cicala, skinvestor1978, spark2023, ssehrat, ssnow327, Steven jolivet, Thucy2023, trader.user1980, tzt, umitege, webgalaxy, xv16, Xxsticsxx, Yowis Zha, Zoltan0013, 西伯利亚风
The content on the MT4talk website is created by its users (MT4talk forum members). MT4talk does not sell Forex robots and does not offer support for them. MT4talk only offer PRO membership which allows for unlimited downloads of content from any forum topic or post. The updates for Forex robots may be limited or not happen at all, depending on who created the robot.
We are testing Forex robots in real-life conditions! We use a demo account to test some of the robots and the results are still accurate. We are not financial advisors and cannot advise you to invest your money. Our aim is to find good market analysis solutions using different strategies that can benefit our community.
CFTC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.
Disclaimer - No representation is being made that any Forex account will or is likely to achieve profits or losses similar to those shown on backtests in this forum. In fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk in actual trading. All information on this forum is for educational purposes only and is not intended to provide financial advice. Any statements posted by forum members or the MT4talk EA Tester Team about profits or income expressed or implied, do not represent a guarantee. Your actual trading may result in losses as no trading system is guaranteed. You accept full responsibilities for your actions, trades, profit or loss, and agree to hold the MT4talk team and forum members of this information harmless in any and all ways.
Affiliates Disclaimer - The website may have links to partner websites, and if you sign up and trade through these links, we will receive a commission. Our affiliate partners are FXOpen, FBS, LQDFX, and MyForexVPS.
Copyright MT4talk.com Forum Rules - Privacy Policy.