// ============================================================================ // ROBÔ HFT SCALPER WINV25 - VERSÃO SIMPLES // Nelogica Profit Pro 5.0 // ============================================================================ Var TakeProfit: Float; StopLoss: Float; PosicaoAberta: Boolean; PrecoEntrada: Float; HoraAtual: Float; MinutoAtual: Float; DiaSemana: Float; Once Begin TakeProfit := 15; StopLoss := 10; PosicaoAberta := False; PrecoEntrada := 0; End; Begin // Obter horário atual HoraAtual := Hour(Time); MinutoAtual := Minute(Time); DiaSemana := DayOfWeek(Date); // Verificar se é dia útil (Segunda=2 a Sexta=6) If (DiaSemana < 2) Or (DiaSemana > 6) Then Exit; // Verificar horário de operação (08:55 às 17:45) If Not ((HoraAtual = 8 And MinutoAtual >= 55) Or (HoraAtual >= 9 And HoraAtual <= 17)) Then Begin // Fechar posição se fora do horário If Position <> 0 Then Begin If Position > 0 Then Sell Position Shares Next Bar At Market Else BuyToCover Abs(Position) Shares Next Bar At Market; End; Exit; End; // Se já tem posição, gerenciar If Position <> 0 Then Begin // Calcular lucro/prejuízo If Position > 0 Then Begin // Posição comprada If (Close >= PrecoEntrada + TakeProfit) Then Sell Position Shares Next Bar At Market; If (Close <= PrecoEntrada - StopLoss) Then Sell Position Shares Next Bar At Market; End Else Begin // Posição vendida If (Close <= PrecoEntrada - TakeProfit) Then BuyToCover Abs(Position) Shares Next Bar At Market; If (Close >= PrecoEntrada + StopLoss) Then BuyToCover Abs(Position) Shares Next Bar At Market; End; Exit; End; // Lógica de entrada - Estratégia simples // Compra se preço está subindo If (Close > Open) And (Close > Average(Close, 9)) And (Volume > 100) Then Begin Buy 1 Shares Next Bar At Market; PrecoEntrada := Close; End; // Venda se preço está descendo If (Close < Open) And (Close < Average(Close, 9)) And (Volume > 100) Then Begin SellShort 1 Shares Next Bar At Market; PrecoEntrada := Close; End; End;