Cancelling and Closing all trades at 1507 on 1M chart  [SOLVED]

Questions about MultiCharts and user contributed studies.
Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Cancelling and Closing all trades at 1507 on 1M chart

Postby Adrian Uncle » 26 May 2016

Hi there,

Below is my code for closing opened trades at 3:07PM on the 1M chart.

Code: Select all

SystemFinalExit = 1507

if TIME >= SystemFinalExit then
Begin
if MarketPosition =-1 then BUYTOCOVER ("EoD Exit") NumberOfContracts CONTRACT NEXT BAR MARKET ;
if MarketPosition = 1 then SELL ("Eod Exit") NumberOfContracts CONTRACT NEXT BAR MARKET ;
End ;
What if there are limit pending orders at the broker? How do I cancel all limit & stop orders at the broker at 3:00PM?
Last edited by Adrian Uncle on 11 Jun 2016, edited 2 times in total.

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Cancelling and Closing all trades at 3:00PM

Postby tony » 26 May 2016

In your list of conditional statements that generate the long or short position you could include a time condition statement like AND TIME <= 1445 and since that would be false, the limit would be cancelled.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Cancelling and Closing all trades at 3:00PM

Postby TJ » 26 May 2016

Hi there,

Below is my code for closing opened trades at 3:00PM on the 15M chart.

Code: Select all


if TIME >= 2:45 then
Begin
if MarketPosition =-1 then BUYTOCOVER ("EoD Exit") NumberOfContracts CONTRACT NEXT BAR MARKET ;
if MarketPosition = 1 then SELL ("Eod Exit") NumberOfContracts CONTRACT NEXT BAR MARKET ;
End ;
What if there are limit pending orders at the broker? How do I cancel all limit & stop orders at the broker at 3:00PM?
A few notes:

1. for liquidation, you do not need to check MarketPosition.

2. look up the keyword ALL

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Adrian Uncle » 26 May 2016

A few notes:

1. for liquidation, you do not need to check MarketPosition.

2. look up the keyword ALL
TJ,

Thanks for the tip but what will happen if I have opened sellshort trades. Will "sell all contract" work in this case?

Code: Select all

Sell All contracts Next Bar At Market;

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Adrian Uncle » 26 May 2016

In your list of conditional statements that generate the long or short position you could include a time condition statement like AND TIME <= 1445 and since that would be false, the limit would be cancelled.
Tony,

If I am trading with both automated and manually, the " AND TIME <= 1445" will not work for my manual limit order trades. I am looking to issue a command to flatten everything and to cancel all pending order at the broker.

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Cancelling and Closing all trades at 3:00PM

Postby tony » 26 May 2016

Why not simply cancel any open orders then if you are not fully automating your trading? Seems like the easiest solution then.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Adrian Uncle » 26 May 2016

Why not simply cancel any open orders then if you are not fully automating your trading? Seems like the easiest solution then.
I am not always at my computer at 3:00PM; hence, a script should be able to perform this task for me.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Cancelling and Closing all trades at 3:00PM

Postby TJ » 26 May 2016

A few notes:

1. for liquidation, you do not need to check MarketPosition.

2. look up the keyword ALL
TJ,

Thanks for the tip but what will happen if I have opened sellshort trades. Will "sell all contract" work in this case?

Code: Select all

Sell All contracts Next Bar At Market;
BUYTOCOVER

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Adrian Uncle » 26 May 2016

Below is the new code. But what about cancelling all other pending orders.

Code: Select all

if TIME >= 2:45 then
Begin
if MarketPosition =-1 then BUYTOCOVER ("EoD Exit") All contracts Next Bar At Market;
if MarketPosition = 1 then SELL ("Eod Exit") All contracts Next Bar At Market;
End ;

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Cancelling and Closing all trades at 3:00PM

Postby JoshM » 27 May 2016

Below is the new code. But what about cancelling all other pending orders.
Pending orders are cancelled when you don't resubmit them in the code (see for instance the buy wiki page).

This means you'll need to implement programming logic in your script that ensures that the limit orders aren't submitted after 14:45 hours.

Code: Select all

if TIME >= 2:45 then
Begin
if MarketPosition =-1 then BUYTOCOVER ("EoD Exit") All contracts Next Bar At Market;
if MarketPosition = 1 then SELL ("Eod Exit") All contracts Next Bar At Market;
End ;
I don't mean to criticise but I see a few errors:

* The `Time` keyword returns the closing time of the bar in 24-hour HHmm format. This means that 2:45 PM is not 245 but 1445.

* The value that's returned by `Time` doesn't include a colon; you used this in a previous post also, but 2:45 isn't valid: it has to be 245. Likewise, 14:45 doesn't work; this needs to be 1445.

There's also room for improvement with this code snippet:

* This code snippet will only close the open position after a certain time; but it doesn't prevent the strategy from opening another position. From what I understand the market that you're trading is open till 15:00. This means that during 14:45 till 15:00 you can end up entering a position followed by closing it immediately afterwards. So your entry conditions also need to use time filtering.

* You might want to implement the RecalcLastBarAfter() keyword to ensure that your script it calculated at least every n seconds. There probably will be enough trades between 14:45 and 15:00 for liquid instruments, but with instruments that don't trade that often (or instruments like options) you're quite dependent on enough trades to have the orders cancelled and the open positions closed. If you use `RecalcLastBarAfter()` you can start closing the orders (and cancelling the open orders) immediately after 14:45, which also ensures that there's enough time to execute everything properly at the broker's side.

* You might want to use IntrabarOrderGeneration so that the strategy can submit (and cancel) orders independent from the bar's resolution. You didn't specify the chart resolution in this thread (but I might have overlooked it), but if you for example use hourly bars then on the close of trading at 15:00 the `time >= 1445` condition is true and the open position can be closed (from the code's standpoint). But at that point, the orders cannot be filled anymore (given that the market is closed). By using `IntrabarOrderGeneration` your signal can calculate even when a price bar hasn't closed, which allows the strategy to close the positions and open order sooner and that also gives enough time on the broker's side to flatten everything.

User avatar
Smoky
Posts: 507
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 97 times
Been thanked: 115 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Smoky » 27 May 2016

In your list of conditional statements that generate the long or short position you could include a time condition statement like AND TIME <= 1445 and since that would be false, the limit would be cancelled.
Tony,

If I am trading with both automated and manually, the " AND TIME <= 1445" will not work for my manual limit order trades. I am looking to issue a command to flatten everything and to cancel all pending order at the broker.

You do use MC signal !From Broker to Strategy MP Synchronizer! and add it to your chart.

and don't need to calculate number of share use ALL keyword for quantity to close your trade

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Adrian Uncle » 02 Jun 2016

What do you think about this code?

Code: Select all

if time > FinalExit OR time < StartTime then
Begin
if MarketPosition_at_Broker_for_The_Strategy =-1 then BUYTOCOVER ("EoD sell Exit") All contracts Next Bar At Market;
if MarketPosition_at_Broker_for_The_Strategy = 1 then SELL("EoD buy Exit") All contracts Next Bar at Market;
end ;

User avatar
Smoky
Posts: 507
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 97 times
Been thanked: 115 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Smoky » 03 Jun 2016

What do you think about this code?

Code: Select all

if time > FinalExit OR time < StartTime then
Begin
if MarketPosition_at_Broker_for_The_Strategy =-1 then BUYTOCOVER ("EoD sell Exit") All contracts Next Bar At Market;
if MarketPosition_at_Broker_for_The_Strategy = 1 then SELL("EoD buy Exit") All contracts Next Bar at Market;
end ;
I prefer

Code: Select all

if time > FinalExit OR time < StartTime then
Begin
if MarketPosition_at_Broker_for_The_Strategy < 0 then BUYTOCOVER ("EoD sell Exit") All contracts Next Bar At Market;
if MarketPosition_at_Broker_for_The_Strategy > 0 then SELL("EoD buy Exit") All contracts Next Bar at Market;
end ;
because you can have more shares on the market with this code ;)

from EL help :

MarketPosition_at_Broker_for_The_Strategy
Returns a numerical value, indicating the number of contracts and the type of position at the broker for the strategy.
A positive value indicates a long position and a negative value indicates a short position.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 3:00PM

Postby Adrian Uncle » 06 Jun 2016

Hi folks,

I took Smoky and Josh's advises and formulated the below code for the 1M chart. However, it is not working properly. FYI, I am trading the US 30 years bond and am using RecalcLastBarAfter() because at 3:07PM the market is slow and new ticks come in infrequently. Currently, I have to close my trades manually because the script is not working. Please note that the market is still opened but the code is not executing. Any thoughts will be greatly appreciated.

Code: Select all

SystemFinalExit = 1507;
if (LastBarOnChart_s = True) then
begin
if time > SystemFinalExit OR time < SystemStartTime then
Begin
if MarketPosition_at_Broker_for_The_Strategy < 0 then BUYTOCOVER ("EoD sell Exit") All contracts Next Bar At Market;
if MarketPosition_at_Broker_for_The_Strategy > 0 then SELL("EoD buy Exit") All contracts Next Bar at Market;
end ;
Print("Current time: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(CurrentTime_s)), ".");
RecalcLastBarAfter(20);
end;

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Cancelling and Closing all trades at 3:00PM

Postby JoshM » 14 Jun 2016

I am trading the US 30 years bond and am using RecalcLastBarAfter() because at 3:07PM the market is slow and new ticks come in infrequently. Currently, I have to close my trades manually because the script is not working. Please note that the market is still opened but the code is not executing. Any thoughts will be greatly appreciated.
I don't see why your code is not executing; from what I can tell, it should always execute, especially your `print()` statement. That's because it's placed inside the if statement that checks whether the last bar is the current bar. And that is, during real-time trading, always the case.

Code: Select all

SystemFinalExit = 1507;

if (LastBarOnChart_s = True) then begin

if time > SystemFinalExit OR time < SystemStartTime then begin

if MarketPosition_at_Broker_for_The_Strategy < 0 then
BUYTOCOVER ("EoD sell Exit") All contracts Next Bar At Market;

if MarketPosition_at_Broker_for_The_Strategy > 0 then
SELL("EoD buy Exit") All contracts Next Bar at Market;

end ;

Print("Current time: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(CurrentTime_s)), ".");

RecalcLastBarAfter(20);

end;
Your if statement that submits the orders to close the position is a little bit odd though, or I misinterpret what the goal of this thread is. But the way I read this if statement's condition, is that the code inside it should only execute when the bar's time is 15:37 exactly:

Code: Select all

if time > SystemFinalExit OR time < SystemStartTime then begin

if MarketPosition_at_Broker_for_The_Strategy < 0 then
BUYTOCOVER ("EoD sell Exit") All contracts Next Bar At Market;

if MarketPosition_at_Broker_for_The_Strategy > 0 then
SELL("EoD buy Exit") All contracts Next Bar at Market;

end ;

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 1507 on 1M chart

Postby Adrian Uncle » 14 Jun 2016

Josh,

I believe that there is something not right with MC platform. See attached code and its output.
[+] show the code

Code: Select all


[IntrabarOrderGeneration = True];
[AllowSendOrdersAlways=True] ;
VAriables: SystemStartTime(900),SystemFinalExit(1417),FinalExit(1506);
if time < SystemFinalExit and LastBarOnChart_s = True then
begin
buy NumberOfContracts Contract NEXT Bar at Market;
Print("test entry", marketposition);
end;


if (LastBarOnChart_s = True) then
begin
if time >= SystemFinalExit OR time < SystemStartTime then
Begin
Print("MarketPosition begin", marketposition);
Print("Inside Current time: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(CurrentTime_s)), ".");
if MarketPosition < 0 then BUYTOCOVER ("EoD sell Exit") All contracts next Bar At Market;
if MarketPosition > 0 then SELL("EoD buy Exit") All contracts next Bar at Market;
Print("MarketPosition end ", marketposition);
end ;
Print("Outside Current time: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(CurrentTime_s)), ".");
RecalcLastBarAfter(10);
end;



test entry 0.00
Outside Current time: 14:15:32.
test entry 0.00
Outside Current time: 14:15:32.
test entry 0.00
Outside Current time: 14:15:32.
test entry 0.00
Outside Current time: 14:15:32.
test entry 0.00
Outside Current time: 14:15:32.
test entry 0.00
Outside Current time: 14:15:42.
test entry 0.00
Outside Current time: 14:15:52.
test entry 1.00
Outside Current time: 14:15:52.
test entry 1.00
Outside Current time: 14:15:52.
test entry 1.00
Outside Current time: 14:15:52.
test entry 1.00
Outside Current time: 14:16:02.
test entry 1.00
Outside Current time: 14:16:12.
test entry 1.00
Outside Current time: 14:16:22.
test entry 1.00
Outside Current time: 14:16:32.
test entry 1.00
Outside Current time: 14:16:42.
test entry 1.00
Outside Current time: 14:16:52.
test entry 1.00
Outside Current time: 14:17:02.
test entry 1.00
Outside Current time: 14:17:12.
test entry 1.00
Outside Current time: 14:17:22.
test entry 1.00
Outside Current time: 14:17:32.
test entry 1.00
Outside Current time: 14:17:42.
test entry 1.00
Outside Current time: 14:17:52.
test entry 1.00
Outside Current time: 14:18:02.
test entry 1.00
Outside Current time: 14:18:12.
test entry 1.00
Outside Current time: 14:18:22.
test entry 1.00
Outside Current time: 14:18:32.
test entry 1.00
Outside Current time: 14:18:42.
test entry 1.00
Outside Current time: 14:18:52.
test entry 1.00
Outside Current time: 14:19:02.
test entry 1.00
Outside Current time: 14:19:12.
test entry 1.00
Outside Current time: 14:19:22.
test entry 1.00
Outside Current time: 14:19:32.
test entry 1.00
Outside Current time: 14:19:42.
test entry 1.00
Outside Current time: 14:19:52.
test entry 1.00
Outside Current time: 14:20:00.
test entry 1.00
Outside Current time: 14:20:10.
test entry 1.00
Outside Current time: 14:20:20.
test entry 1.00
Outside Current time: 14:20:30.
test entry 1.00
Outside Current time: 14:20:40.
test entry 1.00
Outside Current time: 14:20:50.
test entry 1.00
Outside Current time: 14:21:00.
test entry 1.00
Outside Current time: 14:21:10.
test entry 1.00
Outside Current time: 14:21:20.
test entry 1.00
Outside Current time: 14:21:30.
test entry 1.00
Outside Current time: 14:21:40.
test entry 1.00
Outside Current time: 14:21:50.
test entry 1.00
Outside Current time: 14:22:00.
test entry 1.00
Outside Current time: 14:22:10.
test entry 1.00
Outside Current time: 14:22:20.
test entry 1.00
Outside Current time: 14:22:30.
test entry 1.00
Outside Current time: 14:22:40.
test entry 1.00
Outside Current time: 14:22:50.
test entry 1.00
Outside Current time: 14:23:00.
test entry 1.00
Outside Current time: 14:23:10.
test entry 1.00
Outside Current time: 14:23:20.
test entry 1.00
Outside Current time: 14:23:30.
test entry 1.00
Outside Current time: 14:23:40.
test entry 1.00
Outside Current time: 14:23:50.
test entry 1.00
Outside Current time: 14:24:00.
test entry 1.00
Outside Current time: 14:24:10.
test entry 1.00
Outside Current time: 14:24:20.
test entry 1.00
Outside Current time: 14:24:30.
test entry 1.00
Outside Current time: 14:24:40.
test entry 1.00
Outside Current time: 14:24:45.
test entry 1.00
Outside Current time: 14:24:45.
MarketPosition begin 1.00
Inside Current time: 14:24:45.
MarketPosition end 1.00
Outside Current time: 14:24:45.
MarketPosition begin 1.00
Inside Current time: 14:24:45.
MarketPosition end 1.00
Outside Current time: 14:24:45.
MarketPosition begin 0.00
Inside Current time: 14:24:45.
MarketPosition end 0.00
Outside Current time: 14:24:45.
MarketPosition begin 0.00
Inside Current time: 14:24:45.
MarketPosition end 0.00
Outside Current time: 14:24:45.
MarketPosition begin 0.00
Inside Current time: 14:24:55.
MarketPosition end 0.00
Outside Current time: 14:24:55.
MarketPosition begin 0.00
Inside Current time: 14:25:05.
MarketPosition end 0.00


User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Cancelling and Closing all trades at 1507 on 1M chart

Postby Henry MultiСharts » 15 Jun 2016

Hello Adrian Uncle,

I'm not sure what results you expect and what exactly is incorrect in this case. You should provide more detailed description of the specific issue you are having. Based on the information you have provided I can see that the code is based on the bars Time values, while the output is using the computer time:
Time - Returns a numerical value indicating the closing time of the current bar.
CurrentTime_s - Returns a numerical value indicating the computer's current time, including seconds.
If symbol is not updating/updating slow and there is no bar - last bar's time value is returned into the code. While CurrentTime_s continues to update on each script calculation.
If you want your code to be executed disregard the available bar time value - you should switch to computer's time.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 1507 on 1M chart

Postby Adrian Uncle » 15 Jun 2016

Hello Adrian Uncle,
Time - Returns a numerical value indicating the closing time of the current bar.
CurrentTime_s - Returns a numerical value indicating the computer's current time, including seconds.
If symbol is not updating/updating slow and there is no bar - last bar's time value is returned into the code. While CurrentTime_s continues to update on each script calculation.
If you want your code to be executed disregard the available bar time value - you should switch to computer's time.
Henry,

Yes, I wanted to exit trades at a specific time regardless of the market movement. Let's me give it a try and I will update my results.

Many thanks,

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 1507 on 1M chart

Postby Adrian Uncle » 15 Jun 2016

So I changed my code from time to currenttime_s, guess what???

It keeps freezing up my PowerLanguage Editor!!!

Code: Select all

[IntrabarOrderGeneration = True];
[AllowSendOrdersAlways=True] ;
VAriables: SystemStartTime(900),SystemFinalExit(1417),FinalExit(1506);
if currenttime_s < SystemFinalExit and LastBarOnChart_s = True then
begin
buy NumberOfContracts Contract NEXT Bar at Market;
Print("test entry", marketposition);
end;


if (LastBarOnChart_s = True) then
begin
if currenttime_s >= SystemFinalExit OR currenttime_s < SystemStartTime then
Begin
Print("MarketPosition begin", marketposition);
Print("Inside Current currenttime_s: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(CurrentTime_s)), ".");
if MarketPosition < 0 then BUYTOCOVER ("EoD sell Exit") All contracts next Bar At Market;
if MarketPosition > 0 then SELL("EoD buy Exit") All contracts next Bar at Market;
Print("MarketPosition end ", marketposition);
end ;
Print("Outside Current currenttime_s: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(CurrentTime_s)), ".");
RecalcLastBarAfter(10);
end;
My final solution and test code with output are in the next post.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 1507 on 1M chart

Postby Adrian Uncle » 15 Jun 2016

After bugging Henry again -

Below is the final code and it seems to work great! Who knew a simple task can be so complicated with so many setbacks.

FYI, I still don't know why my previous code keeps freezing the PowerLanguage editor. Maybe someone can point out what I did wrong when I changed "time" to "currenttime_s."

Code: Select all

[IntrabarOrderGeneration = True];
[AllowSendOrdersAlways=True] ;

VAriables: SystemStartTime(900),SystemFinalExit(123800),FinalExit(1506);

if time < SystemFinalExit and LastBarOnChart_s = True then
begin
if MarketPosition <= 0 then buy NumberOfContracts Contract NEXT Bar at Market;
Print("Current time: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(CurrentTime_s)), ", marketposition",marketposition );
RecalcLastBarAfter(20);
end;


if currenttime_s >= SystemFinalExit and currenttime_s < SystemFinalExit+30 then
Begin
RecalcLastBarAfter(3);
sell ("EOD_LX") next bar market;
buytocover("EOD_SX") next bar market;
End;


Current time: 12:36:00, marketposition 0.00
Current time: 12:36:00, marketposition 0.00
Current time: 12:36:00, marketposition 0.00
Current time: 12:36:00, marketposition 0.00
Current time: 12:36:00, marketposition 0.00
Current time: 12:36:20, marketposition 0.00
Current time: 12:36:40, marketposition 0.00
Current time: 12:36:40, marketposition 0.00
Current time: 12:36:40, marketposition 1.00
Current time: 12:37:00, marketposition 1.00
Current time: 12:37:20, marketposition 1.00
Current time: 12:37:40, marketposition 1.00
Current time: 12:38:00, marketposition 1.00
Current time: 12:38:03, marketposition 1.00
Current time: 12:38:04, marketposition 1.00
Current time: 12:38:04, marketposition 0.00
Current time: 12:38:07, marketposition 0.00
Current time: 12:38:10, marketposition 0.00
Current time: 12:38:13, marketposition 0.00
Current time: 12:38:16, marketposition 0.00
Current time: 12:38:19, marketposition 0.00
Current time: 12:38:22, marketposition 0.00
Current time: 12:38:25, marketposition 0.00
Current time: 12:38:28, marketposition 0.00
Current time: 12:38:31, marketposition 0.00
Current time: 12:38:51, marketposition 0.00
Current time: 12:39:11, marketposition 0.00
Current time: 12:39:31, marketposition 0.00

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Cancelling and Closing all trades at 1507 on 1M chart  [SOLVED]

Postby Henry MultiСharts » 17 Jun 2016

FYI, I still don't know why my previous code keeps freezing the PowerLanguage editor.
The editor can be freezing it there are too much lines being added to the output tab. You can try commenting the Print statements to see if that helps.
Maybe someone can point out what I did wrong when I changed "time" to "currenttime_s."
Time has HHmm format, while CurrentTime_s has HHmmss format. Please read the help materials to learn how to use the available reserved words correctly.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Cancelling and Closing all trades at 1507 on 1M chart

Postby Adrian Uncle » 17 Jun 2016

Thanks Henry.


Return to “MultiCharts”