Topics
Replies

firemyst
02 May 2025, 08:17

RE: RE: RE: RE: RE: RE: Clipboard.GetText() not working

eynt said: 

These are all too complex, I don't see a reason why a simple copy-paste shouldn't wotk

 

Setting a global static C# variable is took complex? 

All you do is assign it or read it like any other variable. If that's too complex, I'm not sure you should be coding anything.

//To create a "global variable", it should be public and static, and declared in a public static class. 
//In .NET it's a common way to declare constants (e.g. Math.PI), but they're not variables!

public static class EveryoneCanSeeMe
{
    public static string EveryOneCanReadAndModifyMe;
}

 

And as for reading/writing files, the first method below uses just as many lines of code as you need to read/write to the clipboard:

//Method #1 -----------------------
// Writing the string to the file 
File.WriteAllText(yourSavedFilePath, createText); 
  
// Reading the contents of the file 
string readText = File.ReadAllText(yourSavedFilePath); 

//Method #2 -----------------------
//WRite file
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(yourSavedFilePath, false))
{
	sw.Flush();
}

//Read file
if (System.IO.File.Exists(yourSavedFilePath)) 
{
    inputString = System.IO.File.ReadAllText(yourSavedFilePath));
    System.IO.File.Delete(yourSavedFilePath);
}

 

Again, nothing complex about them when you actually try instead of immediately dismissing because it's not how you would like to do it.

 


@firemyst

firemyst
02 May 2025, 06:04

RE: RE: RE: RE: Clipboard.GetText() not working

eynt said: 

I create a button which once clicked gets the text from the clipboard and runs code based on it

 

And that text can't be written to a text file instead and read from there? 

Or copied into a parameter text input field and then the parameter's value read? 

Or set in a global static variable?


@firemyst

firemyst
02 May 2025, 05:55

RE: RE: Clipboard.GetText() not working

eynt said: 

Hi

 

This is the print I got from the code below after copying some text to the clipboard. The a and b prints are working well but not the one of the Clipboard.GetText():

 

02/05/2025 05:46:32.491 | Info | Indicator instance [CopyText, EURUSD, h1] loaded.
02/05/2025 05:46:35.257 | Info | a
02/05/2025 05:46:35.272 | Info | 
02/05/2025 05:46:35.272 | Info | b
 

namespace cAlgo{    [Indicator(IsOverlay = true, AccessRights = AccessRights.FullAccess)]    public class CopyText : Indicator    {        [STAThread]        protected override void Initialize()        {            Print("a");            string text = System.Windows.Forms.Clipboard.GetText();            Print(text);            Print("b");        }        public override void Calculate(int index)        {        }    }}

The Clipboard might not even be available in bots. They do have limitations. Not sure why you'd want access to the clipboard anyway for an indicator?


@firemyst

firemyst
02 May 2025, 00:30

stackoverflow . com /questions/4648718/why-doesnt-clipboard-gettext-work


@firemyst

firemyst
30 Apr 2025, 01:12

If restarting cTrader doesn't fix the issue, then contact your broker as it sounds like they changed pip sizes.


@firemyst

firemyst
29 Apr 2025, 04:49

you should put this in the “Suggestions” forum. Spotware won't come here looking for suggestions, hence why it's not a suggestions forum.


@firemyst

firemyst
29 Apr 2025, 04:47

Who is your actual broker?


@firemyst

firemyst
29 Apr 2025, 02:07

Duplicate.

See this thread:

/forum/indicator-support/46931

 


@firemyst

firemyst
29 Apr 2025, 02:06

To start, you do need to get the Bars data for every other time frame you want that isn't the chart's timeframe:

Bars _marketSeries = MarketData.GetBars(SourceTimeFrame, Symbol.Name);

 

Then, in your calculate method, you need to get the latest information from that/those timeframe(s):

int altIndex = index;
if (Bars.TimeFrame != _marketSeries.TimeFrame)
{
   altIndex = _marketSeries.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
}

 

Then get the values you want using that altIndex Some examples with the moving average and standard deviation:

 

double maResultIndex = _movingAverage.Result[altIndex];
double sd = StandardDeviation * _standardDeviation.Result[altIndex];

 


@firemyst

firemyst
29 Apr 2025, 01:59

Then download one of the many free ones out there


@firemyst

firemyst
29 Apr 2025, 01:57

English


@firemyst

firemyst
29 Apr 2025, 00:09

The code to change the volume is:

<your position>.ModifyVolume(newVolume);

 

To see what's been modified, you'll have to created your event handler method, and then check out the parameter to see what's available to you so you can determine what's been modified:

help . ctrader . com /ctrader-algo/references/EventArgs/PositionModifiedEventArgs/


@firemyst

firemyst
29 Apr 2025, 00:02

What you see is real.

you might be talking “points” and not “pips”. Points are not the same as pips.

The pip size is dependent upon your broker. 

On some brokers, the pipsize is 0.01 points; on other brokers the pipsize might be 0.1 points; etc etc.

So no, you can't change it yourself


@firemyst

firemyst
28 Apr 2025, 23:58

Assets are dependent upon your broker


@firemyst

firemyst
28 Apr 2025, 23:58

Post screen capture of error


@firemyst

firemyst
27 Apr 2025, 02:57

THis is not a technical support forum.

Contact your broker to ask them why your account is locked.


@firemyst

firemyst
27 Apr 2025, 02:57

You can already.

SCale the chart.

Click and grab the timeline, then drag left or right to scale in/out, which adjusts the widths.


@firemyst

firemyst
27 Apr 2025, 02:53

help . ctrader . com /ctrader-algo/guides/messages-and-subscriptions/


@firemyst

firemyst
27 Apr 2025, 02:49

You open up a new tab and have the new tab with the different time frame. You can display all the tabs simultaneously by clicking on the chart mode buttons in the top menu.


@firemyst

firemyst
25 Apr 2025, 05:53

RE: RE: RE: RE: risk reward

jobstkevin02 said: 

firemyst said: 

q.sallahu said: 

firemyst said: I DO NOT HAVE ANY SYMBOL ANY TOOL LIKE THAT ON DISPLAY  EVEN THOUGH MY CTRADER VERSION IS 5.1.14

 

If you had mentioned your version to begin with, we wouldn't be in this predicament.

It wasn't released until version 5.2.5

If you don't have it, you must be using a broker specific version of cTrader instead of the Spotware version.

 

 

 

I have version 5.3.62 and don´t have the tool… Why ? 

 

 

Screen capture. I have no idea how you can go from version 5.1.14 to 5.3.62 when the current Windows desktop version is 5.2.5.

You're apparently not running the web-based version of cTrader, nor the Windows desktop version.


@firemyst