Replies

alistadd
03 Aug 2016, 09:47

So it would be take profit (automatic no matter what profiit is) at a time i select no pips option

if there is no profit then the algo would let it run

So the algo would attempt to close if in profit at a certain time if it is in minus the algo would not close the position and let it run.


@alistadd

alistadd
15 Feb 2016, 08:50

RE: RE:

1007601 said:

alistadd said:

Hello, can someone please help me i want exact 5 dollars profit for all positions algo,

needs to close all positions sometimes 6 open it needs to be exact don't want to have to change any parameters or anything it would really help me thankyou

I just want to be able to creat new algo paste your algo and then play , i tried others but it think it was left to a bit to myself to put unrealised profit here or there it doesn't work.

 

I just want 5 dollars profit for all positions close profit for all positions thanks

Would something like:

 

bool c1 = Account.Equity > Account.Balance + 5;

 

if (c1) 

{

//close all positions here!?!

}

Hello that would be great but not account ballance, i have like 6 open at one time so close on net profit on ctrader, not account balance 5 dollars unless it means the same thing?


@alistadd

alistadd
04 Feb 2016, 11:13

I tried changing perameter to 5 dollars but doesn't work please help thanks


@alistadd

alistadd
04 Feb 2016, 11:11

Hello, i'm new to this its not working for me can you please put exactly as soon as it gets to 5 dollars profit it closes all positions, i've tried changing parameters? sometimes it closes even it i change the 100 to 3.5 it will go to even 10 dollars profit and not even close please help, i just want to make 5 dollars and close all positions sometimes i have like 6 different currencys open its not working. I think something has been left out

 

using System;

using System.IO;

using System.Collections.Generic;

using System.Linq;

using System.Collections;

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.API.Indicators;

using cAlgo.Indicators;

using cAlgo.API.Requests;

using System.Threading;

using System.Timers;

 

namespace cAlgo

{

    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]

    public class profit : Robot

    {

        [Parameter(DefaultValue = 100.0)]

        public double Parameter { get; set; }

 

 

 

        protected override void OnTick()

        {

            int a = 0;

            int b = 0;

 

            foreach (var position in Positions)

                a++;

            foreach (var position in Positions)

                if (position.Pips > Parameter)

                    b++;

            if (a == b)

                foreach (var position in Positions)

                {

                    ClosePosition(position);

                }

 

 

 

 

 

 

 

        }

    }

}

 

 

can you please do it exactly for 5 dollars once hits 5 dollars profit for all positions open thankyou kindly

 

 


@alistadd