Replies

adheer
07 Sep 2016, 09:27 ( Updated at: 21 Dec 2023, 09:20 )

When I try to add the references using the Manage References button, both the indicators are grayed-out in the list of indicators.

When I move the mouse over those two grayed-out indicators I see a message "This indicator cannot be referenced, because it doesn't contain Source Code."

Does it mean I cannot reference an indicator (.algo file) which does not have source code using the Manage References feature ?

 


@adheer

adheer
07 Sep 2016, 08:54 ( Updated at: 21 Dec 2023, 09:20 )

RE:

brunoamancio.ti said:

Is the .algo file defined as Reference like this?

 


I have tried that, it does not help. 
In the Code Editor, I right-click, and select the Add Reference in the drop-down context menu. Next, I select the two algo files, ZigZag.algo and cFractals.algo.
What it actually does is add the following reference entries at the top of the code. 
 

//#reference: ..\Indicators\cFractals.algo
//#reference: ..\Indicators\ZigZag.algo

The only difference is that, the Add Reference step adds the references as relative path, whereas I had it as absolute paths. But it does not solve the problem. I still get the same error.


@adheer

adheer
19 Sep 2014, 09:19

RE:

adheer said:

Here is the code.

It goes through all open positions, and calculates the elapsed time (in seconds) since the position was opened. If the elapsed time is greater than X (seconds), it closes the position.

DateTime currTime = Time;	// The current time.
int posCount = Positions.Count; // Total positions.

for( int i = posCount - 1; i >= 0; i-- )
{
	// Total seconds elapsed for a trade.
	int elapsedSeconds = (int) (currTime.Subtract(Positions[i].EntryTime).TotalSeconds);
	if ( elapsedSeconds > X )
		ClosePosition(Positions[i]);	// Close the trade.
}


Note : I use for loop to iterate (from upper bound to 0) instead of using the foreach iterator. This is because we (may) close the position during the iteration.

Line number 8 in the above code 

if ( elapsedSeconds > X )

should be read as 

if ( elapsedSeconds > X )

The <strong>X</strong> is due to the HTML formatting.


@adheer

adheer
19 Sep 2014, 09:15

Here is the code.

It goes through all open positions, and calculates the elapsed time (in seconds) since the position was opened. If the elapsed time is greater than X (seconds), it closes the position.

DateTime currTime = Time;	// The current time.
int posCount = Positions.Count; // Total positions.

for( int i = posCount - 1; i >= 0; i-- )
{
	// Total seconds elapsed for a trade.
	int elapsedSeconds = (int) (currTime.Subtract(Positions[i].EntryTime).TotalSeconds);
	if ( elapsedSeconds > X )
		ClosePosition(Positions[i]);	// Close the trade.
}


Note : I use for loop to iterate (from upper bound to 0) instead of using the foreach iterator. This is because we (may) close the position during the iteration.


@adheer

adheer
13 May 2014, 06:56

Here is the crash signature :

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	cAlgo.exe
  Application Version:	1.21.34315.47301
  Application Timestamp:	5370b392
  Fault Module Name:	clr.dll
  Fault Module Version:	4.0.30319.17929
  Fault Module Timestamp:	4ffa5753
  Exception Code:	c00000fd
  Exception Offset:	00002cd0
  OS Version:	6.1.7601.2.1.0.256.1
  Locale ID:	1033
  Additional Information 1:	f591
  Additional Information 2:	f591647bb6b16aa45c599c556a2b4760
  Additional Information 3:	6973
  Additional Information 4:	6973df2c28c5c1895f0e64d5565cb52b

 

Also, is there a way to detect whether the robot is running is live-mode or in back-tester mode ?


@adheer