Search found 49 matches

by pcrespo
29 Apr 2020
Forum: MultiCharts
Topic: [AutoTrading] How to get initial margin & maintenance margin
Replies: 7
Views: 2059

Re: [AutoTrading] How to get initial margin & maintenance margin

Here's what I've been doing to successfully auto-update the margin. In the same PT portfolio as my trading strategy, I run the following strategy in parallel on the same instrument: [AllowSendOrdersAlways = False] input: acctCode(2); vars: intrabarpersist LBOC(false), intrabarpersist sentEntry(false...
by pcrespo
20 Apr 2020
Forum: MultiCharts
Topic: [AutoTrading] How to get initial margin & maintenance margin
Replies: 7
Views: 2059

Re: [AutoTrading] How to get initial margin & maintenance margin

I've thought of a solution available to some people, requiring the ability to simultaneously trade real and paper. Have a paper strategy enter a position however often the margin changes. Use the existing commands to find out the initial and maintenance margin. Then pass that info to the real-money ...
by pcrespo
04 Mar 2019
Forum: MultiCharts
Topic: Idea: purposely send a rejected order to test IB connection?
Replies: 3
Views: 1140

Re: Idea: purposely send a rejected order to test IB connection?

I take it back: it doesn't work. It sends the "disconnected" alert whether you're connected or not. It fails because the command RejectedOrderCategory always returns 0 even in the presence of a rejected order, whether trading from PT or the chart, with IOG on or off. If that command were to actually...
by pcrespo
04 Mar 2019
Forum: MultiCharts
Topic: Idea: purposely send a rejected order to test IB connection?
Replies: 3
Views: 1140

Re: Idea: purposely send a rejected order to test IB connection?

It worked! I wrote a signal based on my OP. Last night, IB disconnected in the midnight hour and failed to reconnect. (It seems to happen more on Sunday nights for some reason.) My signal detected that and sent me an alert. //Sends a purposely rejected order to test the connection. //Use a current i...
by pcrespo
03 Mar 2019
Forum: MultiCharts
Topic: Idea: purposely send a rejected order to test IB connection?
Replies: 3
Views: 1140

Idea: purposely send a rejected order to test IB connection?

Say at 1:00 AM you send an invalid order of some sort. If you're connected, the order will get sent and rejected, and you can use a command like RejectedOrderCategory to detect that an order was rejected. If you're disconnected, the order won't get sent to broker in the first place, and the command ...
by pcrespo
02 Oct 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

If I use 4 PT windows, will that use 4 cores?
by pcrespo
01 Oct 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

I suppose it's two strategies: a one-hour entry strategy and a smaller-timeframe exit strategy. We could achieve basically the same thing with stop-limit orders and "SetTrailingStop_pt", but I just remembered we have a good reason not to do that. I'd share the reason, but I'm not sure if my colleagu...
by pcrespo
01 Oct 2018
Forum: MultiCharts
Topic: How to create strategy to buy on 10% drop
Replies: 3
Views: 1005

Re: How to create strategy to buy on 10% drop

It's definitely possible to use the swing high. Are you asking how to code a swing high function? (Because once you have that, coding the strategy you describe would be very easy.)
by pcrespo
01 Oct 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Getting to a more granular time-frame will not solve the problem of "delays" - it will most probably make it worse/ more frequent. I made it less granular, not more. It was 1s and then I made it 15s after your earlier post. And - by the way - delays are not "bad" by default. Depending on your syste...
by pcrespo
01 Oct 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Heh I mean, I'm making the same number of trades (paying the same commission & slippage) regardless of my Data1 interval. It's just, when my signal says it's time to enter/exit, I'd rather not wait. Are you saying the Data1 interval should be at least a minute? Either way, if the delays persist, som...
by pcrespo
01 Oct 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Earlier today, there was a delay that did not correspond to an IQF disconnection, so unfortunately there remains a mystery cause. @Zheka - I didn't realize it was hard for the system, since MC is allegedly capable of trading on tick charts. If it can handle ticks then 1-second should be a piece of c...
by pcrespo
01 Oct 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

@pcrespo, What's the bar interval for your primary trading logic and what would be your typical trade length? Sorry I missed this question before. Currently I have two signals trading. One of them trades 4 instruments using 1-hour Data2 bars while the other trades one instrument using 1-min Data2. ...
by pcrespo
30 Sep 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

@pcrespo, Thanks for posting your code. I will run it as well and let you know if there are any issues. My server is in Frankfurt so about 100ms worse in terms of latency than yours. Have a good weekend. Alex Sorry for the mess of a code. This new code ought to achieve the same thing (good suggesti...
by pcrespo
30 Sep 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Ok I've tweaked my code, and in Registry I increased the sync interval to 1024 seconds (I can't get SpecialPollInterval to work despite using the 0x1 flag, so I have to use powers of 2 via the min/max poll interval). @Zheka - the thread you linked to indirectly provided a big clue. I hadn't thought ...
by pcrespo
30 Sep 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

@wilkinsw - my delays have been happening since the beginning of the year or maybe late last year, so for me it has nothing to do with version 12 R2. @Zheka - you make good points. I should only log delays (defined by my inputs), rather than log the delay at every bar close. Syncing every 16s is pro...
by pcrespo
28 Sep 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Who marked this as Solved? It's not :( @Svetlana - I'll enter the livechat Monday or as soon as I can. I have CloseBarTimeout set to 3. I'm syncing the machine's clock with us.pool.ntp.org every 16 seconds. So far, my log shows a few several-second delays, for instance there was a 9-second delay des...
by pcrespo
19 Sep 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Update: I'm setting up a newly rented dedicated server. This one has an E3 1240v6, is located close to NYC, and is cheaper. It's from a different provider, just to eliminate a variable (though I have zero complaints about OVH). But before I get to the Moment Of Truth, I'm curious about something. IT...
by pcrespo
03 Sep 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

@TJ - dedicated bare metal. @Zheka - quad core was the lowest available from OVH. I'll shop around for a server with faster (and possibly fewer) cores. Given that the data was streaming on time when the recent delay happened, I don't see how the problem can be with IQF. Also, switching to IB data wo...
by pcrespo
31 Aug 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

So today, a long delay happened when it was time to exit a position. Trading ES on a 1-second Data1 timeframe (sync mode, IOG disabled), we were supposed to exit at 16:00:01 but instead exited at 16:00:54 even though there was plenty of volume (and thus, opportunities for the signal to calculate) in...
by pcrespo
31 Aug 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

@Alex - I've turned FastTracing on for good measure, but the problem must be unrelated because the calculation delays happen under all conditions, not just during trades and not just during high volume. They happen when trading just one instrument - any instrument during any hours. Sometimes a delay...
by pcrespo
28 Aug 2018
Forum: User Contributed Studies and Indicator Library
Topic: Email Alert -- Lost Connectivity
Replies: 24
Views: 24478

Re: Email Alert -- Lost Connectivity

I don't have an IB data subscription. I can only open a chart with IQF symbols.

Edit: oh you probably mean in TWS not MC. I'll look into that.
by pcrespo
28 Aug 2018
Forum: User Contributed Studies and Indicator Library
Topic: Email Alert -- Lost Connectivity
Replies: 24
Views: 24478

Re: Email Alert -- Lost Connectivity

I don't use my power of thread resurrection often, but this may be a good time for it. The method proposed ITT to detect a disconnection doesn't work for me in 2018. I tested by manually disconnecting from IB API. No alert, because my signal still prints getappinfo(aistrategyauto)=1 after the discon...
by pcrespo
28 Aug 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Changing the time sync settings hasn't gotten rid of the delays. I think the delays are real, not just a matter of the PC time being inaccurate. My ping to the IB server is 15ms, but if anything, the delay is with IQF, not IB. The signal's calculation is delayed, suggesting that I'm either receiving...
by pcrespo
23 Aug 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Changing the order of PT instruments didn't get rid of the delays. I like the time sync suggestion. For now, I've changed the NTP servers to the appropriate pool.ntp.org ones and changed the polling frequency to 1min instead of 1hour. If that doesn't work, I'll investigate whether the server time is...
by pcrespo
15 Aug 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Re: Delays receiving real-time data

Do you have IQFeed and Multicharts excluded from the antimalware service? Windows Server 2012; we have no anti-malware installed (Defender is not included by default). What is the first contract in your instrument list in Portfolio trader? It should the the one with the highest tick rate. In that c...
by pcrespo
15 Aug 2018
Forum: MultiCharts
Topic: Delays receiving real-time data
Replies: 53
Views: 12615

Delays receiving real-time data

I'm running MC 12 with IQF data and IB API, trading in PT. The changelog for MC12 indicated that this issue might have been fixed, but for me it persists. I've been logging this issue as follows. I wrote a roughly 10-line signal that, every Data1 bar (which is 1 second), prints the bar time (time_s)...
by pcrespo
31 Oct 2017
Forum: MultiCharts
Topic: "Order ___ that needs to be cancelled is not found"
Replies: 1
Views: 897

"Order ___ that needs to be cancelled is not found"

I'm paper-trading and this warning has been flooding my MC log for weeks, at all hours. Is there any way to get rid of it or tell MC to stop trying to cancel the non-existent order? What even causes it? I use Interactive Brokers and the latest version of MC and the IB API. When I open Trader Worksta...
by pcrespo
09 Oct 2017
Forum: MultiCharts
Topic: CANNOT EXECUTE STOPS WHEN BACK TESTING
Replies: 4
Views: 1489

Re: CANNOT EXECUTE STOPS WHEN BACK TESTING

If I'm not mistaken, the unit for the parameter of "setstoploss" is currency, not points. EntryPrice and Close are in units of points. I think all you need to do is multiply by bigpointvalue (a reserved word), as in: setstoploss( EntryPrice * StopLossPct * bigpointvalue ) Make sure your settings in ...
by pcrespo
05 Jan 2017
Forum: MultiCharts
Topic: Missing zero-volume bars in real time
Replies: 5
Views: 4039

Re: Missing zero-volume bars in real time

Does anyone know of a data provider (at least for futures) that sends price information for 0-volume bars? I ask because I was hoping to trade in Portfolio Trader instead of from a chart, but I can't use IOG in PT, so I'm considering switching providers so my signals can send orders without waiting ...
by pcrespo
23 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

You're right! Try the following: Set a date block in your code and only have it start when the chart date >= this date. Set this date to the beginning of 2016 and start your chart a couple of month earlier. I took this concept and did something similar: I started calculating after currentbar > N. Wi...
by pcrespo
22 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

Then take your best estimate and add 50 to it.
My point is there are two seemingly contradictory facts:

1. DMI's true lookback exceeds the input length.
2. When I set MBB=Len, there is never an error message.
by pcrespo
22 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

Don't know. You should just leave it on auto.
I'm using Portfolio Trader. I thought PT didn't have auto mbb?
by pcrespo
22 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

Why do you think when your simplistic singular input Len=5, that your complex multi-layered indicator's ACTUAL total look back should also be 5? I thought I have already explained to you in prev post. You did, and I'll fully grasp it after some more playing around. (Your last post made me wonder if...
by pcrespo
22 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

If your DMI code is required to look back 100 bars to calculate the result, it will only look back 100 bars. It will not look back further than 100 bars. But then why, when I set the lookback (Len) to 5, do I get different DMI+ and DMI- numbers with MBB=5 vs MBB=10 (as shown in the two lists in my ...
by pcrespo
22 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

If there is a function inside the function, and inside the function, there is an [1] appended to one of the variables, you are looking at MBB = Len+1+1... and so on. Ahh ok, I didn't notice recursion in the code. I saw the [1] but thought it was only going back 1, not 1+1+... I'll have to play arou...
by pcrespo
21 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

Have you looked into the codes in DirMovement? Yes, several times now. Nothing I see makes me think it should exceed Len when looking back. Everywhere "Len" appears in the code, nothing jumps out at me. I also looked at the function "TrueRangeCustom", and still no clues. Below is the code, if you w...
by pcrespo
20 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

Did you get the N+1 part? I took it to mean that when MBB = N, the calculation can't begin until the (N+1)th bar. But I see that the phrasing is different: N is the number of bars ago referenced . So if the calculation begins at bar N+1, does that imply that the Nth bar back is being used in the eq...
by pcrespo
20 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

Please copy and paste the manual you have and we can go through it together. The Maximum number of bars a study will reference A study's script can refer to the values of previous bars for use in evaluation of the current bar. When a value of a bar N bars ago is referenced in a script, the study ca...
by pcrespo
20 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

Re: DMI is affected by Max Bars Back [SOLVED]

You have a misunderstanding of the purpose of the MBB. Many people (esp newbies) make the same mistake. Please go back to the manual and study the MBB explanation again. I'm guilty of being a newbie, but none of the manuals (including "mc_users_manual") lend any insight on this issue. I haven't yet...
by pcrespo
20 Nov 2016
Forum: MultiCharts
Topic: DMI is affected by Max Bars Back [SOLVED]
Replies: 20
Views: 4205

DMI is affected by Max Bars Back [SOLVED]

MC version 10 Beta 2 OS Win 7 Ultimate 64-bit I noticed some odd behavior on a chart, so I did a test: input: len(5); vars: filename("C:\Users\user\Desktop\" + NumToStr(len,0) + " & " + NumToStr(maxbarsback,0) + ".txt"), plus(0), minus(0); if barstatus=2 and currentbar<21 then begin DirMovement(High...
by pcrespo
25 Aug 2016
Forum: MultiCharts
Topic: Runtime bug: signal hangs, but not due to an infinite loop.
Replies: 6
Views: 1705

Re: Runtime bug: signal hangs, but not due to an infinite lo

Out of curiosity, do you have a file write/access authorization problem Good thinking, but no. The problem happened before I had any Print statements. It's printing to the desktop folder of the logged in user, where it has all permissions. What is your computer spec? Windows 7 64-bit, 2-core i5, 8g...
by pcrespo
25 Aug 2016
Forum: MultiCharts
Topic: Runtime bug: signal hangs, but not due to an infinite loop.
Replies: 6
Views: 1705

Re: Runtime bug: signal hangs, but not due to an infinite lo

If it were fine, the backtest would finish and generate a performance report. Instead, it crashes at 2% completion. My output demonstrates that it gets to the last line of code, but doesn't return to the 1st line. It's supposed to cycle, because I didn't wrap the entire code in a "once" keyword. It ...
by pcrespo
24 Aug 2016
Forum: MultiCharts
Topic: Runtime bug: signal hangs, but not due to an infinite loop.
Replies: 6
Views: 1705

Runtime bug: signal hangs, but not due to an infinite loop.

MC version 9.1 I'm backtesting a signal in Portfolio Trader. It makes some progress then freezes and crashes PT (it stops responding after I cancel the backtest) so I have to end the PT process. No error message and nothing in the MCPortfolio >> StudyRunner_Trace log. So I tried debugging by printin...
by pcrespo
16 Aug 2016
Forum: MultiCharts
Topic: IB/MC: How to manage Rollover [SOLVED]
Replies: 7
Views: 3845

Re: IB/MC: How to manage Rollover [SOLVED]

If I map IQFeed's @ES#C to IB's ESU6 for example, and I am using @ES#C (which I used for development & testing) in the Portfolio Trader (PT) Strategy Instruments section for both Tradeable and Informational, then PT would be using IQFeed's price data to fire signals and manage trades, but executions...
by pcrespo
29 Jul 2016
Forum: MultiCharts
Topic: Hidden orders [SOLVED]
Replies: 2
Views: 1496

Hidden orders [SOLVED]

Is there a way in powerlanguage to specify a hidden stop order? I'm talking about what's described here -- https://www.interactivebrokers.com/en/? ... hidden.php
by pcrespo
27 May 2016
Forum: MultiCharts
Topic: Portfolio Trader missing some bar close times [SOLVED]
Replies: 4
Views: 1752

Re: Portfolio Trader missing some bar close times [SOLVED]

Edit: ohh wow, duh, of course it can't trade while the market is closed, that's why it waits until the re-open. Haha some questions are too dumb for the FAQ which is why I couldn't find my answer there.

Thanks and sorry for this thread lol.
by pcrespo
26 May 2016
Forum: MultiCharts
Topic: Portfolio Trader missing some bar close times [SOLVED]
Replies: 4
Views: 1752

Re: Portfolio Trader missing some bar close times [SOLVED]

The top left and top middle windows are screenshots from PT. The bottom two are from QuoteManager, showing that I'm using the symbol dictionary sessions. The top right window shows the dictionary settings of the symbol I'm testing. I see the dictionary settings say there should be a close at 4:15pm ...
by pcrespo
25 May 2016
Forum: MultiCharts
Topic: Portfolio Trader missing some bar close times [SOLVED]
Replies: 4
Views: 1752

Portfolio Trader missing some bar close times [SOLVED]

Hi all. I feel like this is a noob question, but I've read the documentation and FAQ to no avail. My data provider is IQFeed. I'm testing the continuous-adjusted ES in Portfolio Trader, and I've selected @ES#C under the CME exchange with default exchange settings. For the strategy, I'm using test co...

Go to advanced search