Escolar Documentos
Profissional Documentos
Cultura Documentos
Codigo Simples Robozinho Xau Cha GPT
Codigo Simples Robozinho Xau Cha GPT
//| XAU_ARQUIVO_GPT.mq4 |
//| Copyright 2023, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| EA para abrir ordem de Buy no início do candle |
//| com distância de 1000 pips, TP de 500 pips e SL de 500 pips |
//+------------------------------------------------------------------+
extern double Lots = 0.01; // Tamanho do lote
extern int Distance = 1000; // Distância em pips para abrir uma nova ordem
extern int TakeProfit = 500; // Take profit em pips
extern int StopLoss = 500; // Stop loss em pips
int start()
{
// Verificar se é uma nova vela
if (isNewCandle())
{
// Calcular o preço de abertura da ordem de compra
double openPrice = iOpen(Symbol(), PERIOD_CURRENT, 1);
return 0;
}
bool isNewCandle()
{
static datetime lastCandleTime = 0;
return false;
}