AW Calc Volume free

by khoshroomahdi in category Trend at 08/07/2022
Description

this indicator calculate your olume based on your risk percent and stop(pip).

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
using cAlgo.API;
using System;
using Microsoft.Win32;
namespace cAlgo
{
    // This sample indicator shows how to add a text box control on your chart
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class AWCalcVolume : Indicator
    {

        double risk;
        double pip;
        TextBox textBox3 = new TextBox();



        [Parameter("Horizontal Alignment ", DefaultValue = HorizontalAlignment.Left)]
        public HorizontalAlignment HAlignment { get; set; }

        [Parameter("Vertical Alignment", DefaultValue = VerticalAlignment.Top)]
        public VerticalAlignment VAlignment { get; set; }

        [Parameter("Orientation", DefaultValue = Orientation.Horizontal)]
        public Orientation Orientation1 { get; set; }

        [Parameter("Color", DefaultValue = "Red")]
        public string color { get; set; }


        protected override void Initialize()
        {
            var mainStackPanel = new StackPanel 
            {
                HorizontalAlignment = HAlignment,
                VerticalAlignment = VAlignment,
                Orientation = Orientation1
            };
            var StackPanel1 = new StackPanel 
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Orientation = Orientation.Vertical
            };
            var StackPanel2 = new StackPanel 
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Orientation = Orientation.Vertical,
                Margin = 3
            };
            var StackPanel3 = new StackPanel 
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Orientation = Orientation.Vertical
            };
            var textBlock1 = new TextBlock 
            {
                ForegroundColor = color,
                HorizontalAlignment = HorizontalAlignment.Center,
                Text = "Risk%"
            };

            var textBox1 = new TextBox 
            {
                ForegroundColor = color,
                HorizontalAlignment = HorizontalAlignment.Center,
                Width = 50,
                BorderThickness = 2,
                BorderColor = color,
                TextAlignment = TextAlignment.Center,
                Text="3"
               
            };
            var textBlock2 = new TextBlock 
            {
                ForegroundColor = color,
                HorizontalAlignment = HorizontalAlignment.Center,
                Text = "SL(pips)"
            };
            var textBox2 = new TextBox 
            {
                ForegroundColor = color,
                HorizontalAlignment = HorizontalAlignment.Center,
                Width = 50,
                BorderThickness = 2,
                BorderColor = color,
                TextAlignment = TextAlignment.Center,
                Text="10"
            };


            var textBlock3 = new TextBlock 
            {

                ForegroundColor = color,
                HorizontalAlignment = HorizontalAlignment.Center,
                Text = "Volume"
            };


            risk = Convert.ToDouble(textBox1.Text);
            pip = Convert.ToDouble(textBox2.Text);

            textBox3.ForegroundColor = color;
            textBox3.HorizontalAlignment = HorizontalAlignment.Center;
            textBox3.Width = 50;
            textBox3.BorderThickness = 2;
            textBox3.BorderColor = color;
            textBox3.IsEnabled = false;
            textBlock3.TextAlignment = TextAlignment.Center;



            textBox1.TextChanged += TextBox1_TextChanged;
            textBox2.TextChanged += TextBox2_TextChanged;


            StackPanel1.AddChild(textBlock1);
            StackPanel1.AddChild(textBox1);

            StackPanel2.AddChild(textBlock2);
            StackPanel2.AddChild(textBox2);

            StackPanel3.AddChild(textBlock3);
            StackPanel3.AddChild(textBox3);

            mainStackPanel.AddChild(StackPanel1);
            mainStackPanel.AddChild(StackPanel2);
            mainStackPanel.AddChild(StackPanel3);

            Chart.AddControl(mainStackPanel);
        }
        private void TextBox1_TextChanged(TextChangedEventArgs obj)
        {
            risk = Convert.ToDouble(obj.TextBox.Text);
        }
        private void TextBox2_TextChanged(TextChangedEventArgs obj)
        {
            pip = Convert.ToDouble(obj.TextBox.Text);
        }
        public override void Calculate(int index)
        {
            textBox3.Text = CalcVolume(risk, pip);

        }

        public string CalcVolume(double r, double p)
        {

            return Math.Round(Symbol.VolumeInUnitsToQuantity(Account.Balance * r / 100 / (pip * Symbol.PipValue)), 2).ToString();


        }
    }
}
Comments

coreywitt31 - July 09, 2022 @ 07:07

There is no sign of slowing down the number of new Wordle-inspired map and geography games. Wheredle, a new twist on the viral word game, is my current fave.

robertmayy19 - July 11, 2022 @ 12:45

Calculating the amount and risk will reduce the unwanted. canuckle

anna.stark266 - July 13, 2022 @ 13:10

Thanks for sharing this information. Retro Bowl really like your blog post very much. You have really shared a informative and interesting blog post with people.

ciararoisin37 - August 03, 2022 @ 14:53

It is the best website that let me make my own website (Ireland CV) with perfect coding. It has been 5 years since I have been coding but still, there are a lot of things that I still need to learn.

junealexis001 - September 12, 2022 @ 12:06

Great site i love it keep posting more!   https://fencinglexingtonky.com

0