Topics
Replies
davideng5555
10 Nov 2017, 16:08
RE:
Panagiotis Charalampous said:
Hi animegalaxi,
Thanks for posting in our forum! See below an example of how you can close approximately 2/3 of a position. Note that the closing volume should always adhere to the Symbol's volume step requirements, therefore the exact 2/3 is not always achievable.
var steps = Positions[0].Volume / Symbol.VolumeStep; var stepsToClose = (int)(steps * 2 / 3); ClosePosition(Positions[0], Symbol.VolumeStep * stepsToClose);
Hi, is it possible to combine this script above with the other one you wrote below?
Thank you very much,
David
---------------------------------------------------------
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SamplecBot: Robot
{
[Parameter("Min TP")]
public double MinTP { get; set; }
[Parameter("Max TP")]
public double MaxTP { get; set; }
protected override void OnTick()
{
foreach (var position in Positions)
{
if (position.Pips > MinTP && position.Pips < MaxTP)
{
ClosePosition(position);
}
}
}
}
}
@davideng5555
davideng5555
12 Oct 2017, 18:05
RE:
Just a few positions were opened during the test, ranges all within 25 pips.
Used many old 'close position bots' in the past and they all are different.
But the CLOSE ALL can close many hundred positions in a wink.
Maybe I was a bit too sensitive.
Thank you very much.
@davideng5555
davideng5555
12 Oct 2017, 17:17
RE:
Hi Panagiotis,
During execution, it is a bit lagging while searching for the selected value,
Is it the way I arrange the postions at the 'position box'?
Best Regards
David
@davideng5555
davideng5555
12 Oct 2017, 17:07
RE:
Hi Panagiotis,
Thank you very much, tested with great results.
Is there a way to speed up the execution?
Best Regards
David
@davideng5555
davideng5555
12 Oct 2017, 16:53
RE: RE: RE:
Hi Panagiotis,
How to built a code to close all the winning postions, within the selected pip range.
Thank you very much,
Best Regards
David
@davideng5555
davideng5555
12 Oct 2017, 16:37
RE:
Hi Panagiotis,
How to make your script into a stand alone robot.
-------------------------------------------------------------
if (position.Pips > MinTP && position.Pips < MaxTP)
{
ClosePosition(position);
}
Thank you very much, I tried without success.
Best Regards
David
@davideng5555
davideng5555
12 Oct 2017, 15:46
RE:
Hi Panagiotis,
What to do when trying to edit a robot, and there is only this message.
'Source code is not available.'
Thank you very much
David.
@davideng5555
davideng5555
12 Oct 2017, 14:58
RE:
Hi Panagiotis,
Thank you very much, I will run the bot and try it.
Best Regards
David
@davideng5555
davideng5555
12 Oct 2017, 14:50
RE:
Hi Panagiotis.
It will be great if the numbers can be selected manually from a box.
-------------
if (position.Pips > 5 && position.Pips < 20)
{
ClosePosition(position);
Thank you very much.
David
@davideng5555
davideng5555
12 Oct 2017, 14:30
RE:
Hi Panagiotis.
Good afternoon, thank you for the script.
Which line to insert this script at?
Thank you
--------------
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MULTIMARKETORDER : Robot
{
[Parameter("Lot Size", DefaultValue = 0.01)]
public double lot { get; set; }
[Parameter("Positions nr.", DefaultValue = 100)]
public int nr { get; set; }
[Parameter("Buy ?")]
public bool buy { get; set; }
[Parameter("Sell ?")]
public bool sell { get; set; }
protected override void OnStart()
{
long volume = Symbol.QuantityToVolume(lot);
if (buy)
{
for (int i = 0; i < nr; i++)
ExecuteMarketOrder(TradeType.Buy, Symbol, volume);
}
if (sell)
{
for (int i = 0; i < nr; i++)
ExecuteMarketOrder(TradeType.Sell, Symbol, volume);
}
}
}
}
@davideng5555
davideng5555
29 Sep 2017, 17:12
RE:
Hi Panagiotis,
Thank you very much for everything,
Have a nice weekend.
David
@davideng5555
davideng5555
29 Sep 2017, 16:33
RE:
Hi Panagiotis,
Thank you for the advice,
According to the example, How to choose to close a particular Deal.
Kind Regards
David
@davideng5555
davideng5555
28 Sep 2017, 17:09
RE:
davideng5555 said:
According to the example -
The first 10k ia -€100, while the second 10k +€50.
How much do I win or lose when partially closed 5k ?
@davideng5555
davideng5555
28 Sep 2017, 16:58
Hi Panagiotis,
Thank you for the example.
The "equal to €0" applies to the remaining 15k or the 5k that is to be partially closed ?
Thank you
Regards
David
@davideng5555
davideng5555
28 Sep 2017, 16:23
Hi Panagiotis,
Thank you for the advice,
when partially closing postions which had either doubled or prior added,
which contact will be closed ?
Thank you
Best Regards
David
@davideng5555
davideng5555
28 Sep 2017, 16:04
Hi Panagiotis,
Thank you for the advice, when using the partially closing function, which postions will be closed ?
Is it according to the net profit or created time or others ?
Thank you
Best Regards
David
@davideng5555
davideng5555
28 Sep 2017, 15:46
Hi Panagiotis,
Thank you for your advice, there is some open positions in standard lots and would like to split them into mini and micro lots. How to proceed them?
Kind Regards
David
@davideng5555
davideng5555
07 Mar 2017, 09:23
RE:
lucian said:
You can start with this code:
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter("Lot Size", DefaultValue = 0.01)] public double lot { get; set; } [Parameter("Positions nr.", DefaultValue = 100)] public int nr { get; set; } [Parameter("Buy ?")] public bool buy { get; set; } [Parameter("Sell ?")] public bool sell { get; set; } protected override void OnStart() { long volume = Symbol.QuantityToVolume(lot); if (buy) { for (int i = 0; i < nr; i++) ExecuteMarketOrder(TradeType.Buy, Symbol, volume); } if (sell) { for (int i = 0; i < nr; i++) ExecuteMarketOrder(TradeType.Sell, Symbol, volume); } } } }Thank You very much lucian,
Got it worked and running, that's my first build from your script.
Better than intended as it can be use manually or get the exact amount filled, took a while though.
Cheers.
David
@davideng5555
davideng5555
06 Mar 2017, 20:35
RE:
kricka said:
The Market Order 2.0 can solve this but you need to open up several windows with the cBot and configure them differently.
Have a look at the information and the download link here: Market Order 2.0
Thank you for very much,
And is there any way to open ten, twenty market orders with a single click?
@davideng5555
davideng5555
13 Nov 2017, 16:07
RE:
Panagiotis Charalampous said:
Hi Panagiotis,
Can you please post the full script of "Close approximately 2/3 of a position".
Is it possible to combine with the Close Position you wrote?
Thank you very much,
David
@davideng5555