Skip to content

Instantly share code, notes, and snippets.

@danielnegri
Created September 9, 2024 15:09
Show Gist options
  • Save danielnegri/3769a27cd101356b68fcf7666754b28c to your computer and use it in GitHub Desktop.
Save danielnegri/3769a27cd101356b68fcf7666754b28c to your computer and use it in GitHub Desktop.
PowerCandle - Indicador (Profit)
var
hasVolume : Boolean;
hasBody : Boolean;
isUpBar : Boolean;
ExtRSI : float;
ExtRSIOverbought, ExtRSIOverbought, ExtRSIOversold : boolean;
ExtStochastic, ExtStochasticSMA : float;
ExtStochasticOverbought, ExtStochasticOversold : boolean;
ExtStochasticCrossedAbove, ExtStochasticCrossedBelow : boolean;
begin
hasVolume := (volume > Media(3,volume));
hasBody := (open - close) > (high - low) * 0.6;
isUpBar := open < close;
ExtRSI := RSI(14, 0);
ExtRSIOversold := ExtRSI < 30;
ExtRSIOverbought := ExtRSI > 70;
ExtStochastic := SlowStochastic(14, 3, 0);
ExtStochasticSMA := Media(3,ExtStochastic);
ExtStochasticOversold := ExtStochastic < 20;
ExtStochasticOverbought := ExtStochastic > 80;
ExtStochasticCrossedAbove := ExtStochasticOversold and (ExtStochastic[0] > ExtStochasticSMA[0]) and (ExtStochastic[1] < ExtStochasticSMA[1]);
ExtStochasticCrossedBelow := ExtStochasticOverbought and (ExtStochastic[1] < ExtStochasticSMA[0]) and (ExtStochastic[1] > ExtStochasticSMA[1]);
// Indicator O
if hasVolume and ExtStochasticOversold and isUpBar then
begin
PlotText(Round(range) ,clBlack,tpTopLeft,8);
PaintBar(clGreen);
end;
if hasVolume and ExtStochasticOverbought and not isUpBar then
begin
PlotText(Round(range) ,clBlack,tpBottomLeft,8);
PaintBar(clRed);
end;
if hasVolume and ExtStochasticCrossedAbove and isUpBar then PaintBar(RGB(198,245,15));
if hasVolume and ExtStochasticCrossedBelow and not isUpBar then PaintBar(RGB(246,116,83));
if ExtStochasticOversold and ExtRSIOversold and isUpBar then PaintBar(clGreen);
if ExtStochasticOverbought and ExtRSIOverbought and not isUpBar then PaintBar(clRed);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment