Description
This indicator dynamically on each tick draws symmetrical lines around a current price to give you a quick idea when your profit target and stop loss maybe located in relation to current price, swings, pivots and generally price action. Nothing advanced, but useful tools to visualize your action before you actually take it.
You might want to use in combo with this indicator ;)
Enjoy safe trading!!!
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
public class DrawStopLevels : Indicator
{
[Parameter("Stop 1 pips", DefaultValue = 20)]
public int stop1Pips { get; set; }
[Parameter("Stop 2 pips", DefaultValue = 10)]
public int stop2Pips { get; set; }
public override void Calculate(int index)
{
if (IsLastBar && TimeFrame <= TimeFrame.Hour)
{
double currentPriceLevel = Symbol.Ask;
//draw stop 1 pips
double currentPriceAboveLevel1 = Symbol.Ask + (Symbol.PipSize * stop1Pips);
double currentPriceBelowLevel1 = Symbol.Ask - (Symbol.PipSize * stop1Pips);
ChartObjects.DrawText("stopLevel1AboveLabel", "\t" + stop1Pips + "p", index, currentPriceAboveLevel1, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Orange);
ChartObjects.DrawLine("stopLevel1Above", index, currentPriceAboveLevel1, index - 30, currentPriceAboveLevel1, Colors.Orange, 1, LineStyle.LinesDots);
ChartObjects.DrawText("stopLevel1BelowLabel", "\t" + stop1Pips + "p", index, currentPriceBelowLevel1, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Orange);
ChartObjects.DrawLine("stopLevel1Below", index, currentPriceBelowLevel1, index - 30, currentPriceBelowLevel1, Colors.Orange, 1, LineStyle.LinesDots);
//draw stop 2 pips
double currentPriceAboveLevel2 = Symbol.Ask + (Symbol.PipSize * stop2Pips);
double currentPriceBelowLevel2 = Symbol.Ask - (Symbol.PipSize * stop2Pips);
ChartObjects.DrawText("stopLevel2AboveLabel", "\t" + stop2Pips + "p", index, currentPriceAboveLevel2, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Orange);
ChartObjects.DrawLine("stopLevel2Above", index, currentPriceAboveLevel2, index - 20, currentPriceAboveLevel2, Colors.Orange, 1, LineStyle.LinesDots);
ChartObjects.DrawText("stopLevel2BelowLabel", "\t" + stop2Pips + "p", index, currentPriceBelowLevel2, VerticalAlignment.Top, HorizontalAlignment.Right, Colors.Orange);
ChartObjects.DrawLine("stopLevel2Below", index, currentPriceBelowLevel2, index - 20, currentPriceBelowLevel2, Colors.Orange, 1, LineStyle.LinesDots);
}
}
}
}
CO
colga645
Joined on 01.06.2015 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Draw Stop Levels.algo
- Rating: 0
- Installs: 3894
- Modified: 13/10/2021 09:54
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.