EasyLanguage Collective2 Interface (MultiCharts to Collective 2) - futures io
futures io



EasyLanguage Collective2 Interface (MultiCharts to Collective 2)


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Big Mike with 18 posts (12 thanks)
    2. looks_two gpw797 with 5 posts (0 thanks)
    3. looks_3 bomberone1 with 4 posts (0 thanks)
    4. looks_4 NicoVersailles with 3 posts (0 thanks)
    1. trending_up 20,012 views
    2. thumb_up 14 thanks given
    3. group 13 followers
    1. forum 41 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

EasyLanguage Collective2 Interface (MultiCharts to Collective 2)

(login for full post details)
  #1 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

I found myself needing an EasyLanguage way to submit orders to Collective2. If you aren't familiar with C2, you should check it out:

Find the trading strategy best for you

Their top performing systems earn about $10k a month.

So, I could write a C++ DLL interface, and write my own URL-fetching routines, my own XML parser, and more but it's late so I decided to see what I could hack out in an hour of "old school" methods.

I decided the easiest thing to do would be to write a Collective2 function, that I can call from my signal. The function will then build the proper query and output to a text file the URL query. From there, wget for Windows (free, GNU) seemed like the easiest way to execute the URL query without using C++.

Signal
Call C2 Function where Buy and Sellshort commands are used.

Function
Build URL query and output to text file.

DOS
Use a batch file to check for a new text file (new signal generated), then use wget to execute the signal (URL query).

I built the function using the Signal API guidelines from Collective 2:
C2 Signal Entry API

If there is interest in this, please let me know and I'll post the code on the condition you have an existing C2 system in place and will help me test it

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following 8 users say Thank You to Big Mike for this post:

Journal Challenge April 2021 results:
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(616 thanks from 61 posts)
looks_twoSalao's Journalby Salao
(159 thanks from 29 posts)
looks_3Learning to Profit - A journey in algorithms and optionsby Syntax
(115 thanks from 27 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(94 thanks from 30 posts)
looks_5Maybe a little bit different journalby Malykubo
(53 thanks from 32 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
I finally blew up an account
403 thanks
The Crude Dude Oil Trading System
81 thanks
Spoo-nalysis ES e-mini futures S&P 500
64 thanks
The tiyfTradePlanFactory indicator
25 thanks
Building a Crypto Mining Rig
19 thanks
 
(login for full post details)
  #3 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


I should also add that my method supports limit orders, stop orders (for entry), profit targets and stops (stop loss).

This is a big improvement over the limited functionality built-in to NinjaTrader with C2, as NT only submits market orders as they are filled.

With my function you can submit your profit target and stop loss orders, which are OCO, at the time of entry. You can also specify a limit order or a buy stop ahead of time to prevent slippage, which is a big issue with C2 systems in a volatile market.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #4 (permalink)
 phyzfer 
Chicago
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus/Zen-FIre
Trading: GC, ES
 
Posts: 73 since Mar 2010
Thanks: 40 given, 32 received

BM,

I'm not quite sure I understand the purpose of this. Is your NT-C2 'connector' going to listen to C2 orders and place orders using NT? Or are you creating a strategy that will be hosted on C2 and need to know how to broadcast signals out?

thanks-

Reply With Quote
 
(login for full post details)
  #5 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


phyzfer View Post
BM,

I'm not quite sure I understand the purpose of this. Is your NT-C2 'connector' going to listen to C2 orders and place orders using NT? Or are you creating a strategy that will be hosted on C2 and need to know how to broadcast signals out?

thanks-

Take NT out of the equation, I was just listing the C2 support in NT for comparison only.

Yes, the purpose of this is for any EasyLanguage user to be able to send orders to their C2 strategies and specify stops, targets, etc. To my knowledge, the only apps/interfaces so far for TradeStation don't let you specify stops and targets or place orders ahead of time with limit orders (just like NT doesn't), and also they don't work with MultiCharts at all.

So I figured there was a need for this.

If you are trying to autotrade a C2 strategy as a client, that is not what this is for.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #6 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Ok here is the function code. I've not tested the buy stop and sell stop, but I have tested everything else and to my knowledge it all works as expected. Please make improvements and contribute them back to the community.

 
Code
                            
// Big Mike Trading https://futures.io

// Apr 5 2010

http://www.collective2.com/content/automationEncloser.htm }

{
Parameter      Value or Example      What it Means      Comments
cmd
=     signal            
systemid
=     123456     The system ID displayed as above.      
pw=     loginPassword           case sensitive
action
=     BTO     Buy To Open     open a long position
    SSHORT     Sell Short     used 
for stocks
    STO     Sell To Open     used 
for non-stocks
    BTC     Buy To Close     close a short position
    STC     Sell To Close     close a long position
quant
=     100     Number of shares or contracts      
instrument
=     stock           Note that ETFs like QQQ and DIA are traded on a stock exchange and thus are considered stocks.
      
option            
      future            
      forex            
symbol
=     IBM           You are responsible for looking up your own symbols. If you trade Forexyou know that Collective2 figures out Forex symbols automatically when you manually enter trades on the Web siteHoweveryou'll need to enter already-valid symbols when using the Web service interface. 
limit=     35.06           Only use if this is a limit order.
stop=     20.10           Only use if this is a stop order. For market orders, do not use either stop or limit parameters.
duration=     DAY     Day Order      
      GTC     Good Til Cancel      

}

{
The URL is in the following format:

http://www.collective2. com/cgi-perl/signal. mpl?[PARAMETERS]
}

inputs:
    cmd ( StringSimple ), { signal, closeallpositions }
    systemid ( NumericSimple ), { c2 system id }
    pw ( StringSimple ), { c2 password for said id }
    action ( StringSimple ), { BTO, SSHORT, STO, BTC, STC }
    quant ( NumericSimple ), { order quantity }
    instrument ( StringSimple ), { stock, option, future, forex }
    c2symbol ( StringSimple ), { symbol for instrument }
    c2limit ( NumericSimple ), { optional }
    c2stop ( NumericSimple ), { optional buy stop/sell stop }
    c2target ( NumericSimple ), { target price, 0 for none, use with stoploss for OCO }
    c2stoploss ( NumericSimple ), { stop loss price, 0 for none, use with target for OCO }
    duration ( StringSimple ); { DAY, GTC }

vars:
    result ( 0 ),
    filename ( "C:\Users\Mike\Documents\MultiCharts\Collective2\signal.txt" ),
    c2baseurl ( "http://www.collective2.com/cgi-perl/signal.mpl?" ),
    c2query ( "null" );


if cmd = "signal" then begin
    c2query = text(c2baseurl, "cmd=", cmd, "&systemid=", systemid:0:0, "&pw=", pw, "&action=", action, "&quant=", quant:0:0, "&instrument=", instrument, "&symbol=", c2symbol, "&duration=", duration);

    if c2limit > 0 then c2query = c2query + "&limit=" + text(c2limit:0:2);
    if c2stop > 0 then c2query = c2query + "&stop=" + text(c2stop:0:2);
    if c2target > 0 then c2query = c2query + "&profittarget=" + text(c2target:0:2);
    if c2stoploss > 0 then c2query = c2query + "&stoploss=" + text(c2stoploss:0:2);
end;

if cmd = "closeallpositions" then begin
    c2query = text(c2baseurl, "cmd=", cmd, "&systemid=", systemid:0:0, "&pw=", pw);

end;

if GetAppInfo(aiRealTimeCalc) = 1 then FileAppend(filename,c2query + newline);
Text_New(date, time, C, text("c2: ", cmd, action, quant:0:0));
if c2target > 0 then Text_New(date, time, c2target, text("c2: target ", c2target:0:2));
if c2stoploss > 0 then Text_New(date, time, c2stoploss, text("c2: stop ", c2stoploss:0:2)); 
Let me try to explain the logic:

a) if cmd = signal, we generate a query URL comprised of the system id, password, action (buy to open, sell to open, cover, etc), order quantity, instrument, and duration (GTC/DAY).

b) we further check for optional parameters of a limit price (if no limit price specified, we use a market order).

c) we further check for a stop price (this is a buy stop/sell stop, not a stop loss order). if no stop is specified, we use a market order.

d) we further check for a target price (profit target). if both target and stop loss specified, they are OCO.

e) we further check for a stop loss price. if both target and stop loss specified, they are OCO.

f) if cmd = "closeallpositions" we issue a close all positions order. everything except the systemid and password are ignored in this case.

g) now we've built our query URL.

h) we check to see if we are operating on real-time or historical bars. if real-time bars, we create our signal file. You should modify this to suit your needs. I put mine in C:\Users\Mike\Documents\MultiCharts\Collective2\signal.txt. You'll need something different.

We append to the file if it exists already. If it does not exist it is created. Don't try to put this in Program Files directory if you are using Vista or 7 because you won't have the admin rights to do it. Users\Documents is most logical place.

i) we draw some info to the chart to show what we submitted to c2. feel free to get rid of this, it is more debug.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #7 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Now let's talk about the signal itself and calling the function:

 
Code
                            
vars:

c2id(123456789),
c2pw("myc2password");

// example 1

// open a new long position (BTO)
// instrument QCLK0 (Crude Oil futures, May 2010)
// market order
// profit target is Close of this bar + 20 ticks
// stop loss is Close of this bar - 20 ticks
// order duration is DAY

Buy 1 Contracts This Bar At Close;

Value1 Collective2("signal"c2idc2pw"BTO"1"future""QCLK0"00, (Close + (20 MinMove/PriceScale)), (Close - (20 MinMove/PriceScale)), "DAY");


// example 2

// open a new short position (STO)
// instrument QCLK0 (Crude Oil futures, May 2010)
// market order
// profit target is Close of this bar - 20 ticks
// stop loss is Close of this bar + 20 ticks
// order duration is DAY

Sellshort 1 Contracts This Bar At Close;

Value1 Collective2("signal"c2idc2pw"STO"1"future""QCLK0"00, (Close - (20 MinMove/PriceScale)), (Close + (20 MinMove/PriceScale)), "DAY");


// example 3

// close all positions forcefully
// I do this as a precautionary measure when MarketPosition[1] <> MarketPosition, just to make sure we're closed
// all we need is the c2 id, password, and symbol

Value1 Collective2("closeallpositions"c2idc2pw"null"0"future""QCLK0"0000"DAY"); 
Some pointers:

a) if your order quantity is more than 1, but your targets and/or stops are different for each lot, you should submit multiple calls to the function (ie: value1 = collective2(), value2 = collective2(), etc) each with a quantity of 1 and the proper target/stop.

b) if your EL strat is flat, you should make sure your C2 strat is flat by submitting an extra close all positions command. this is because your EL strat may think a target or stop was hit, and exit the position internally, but yet C2 not have been hit and still remain in a position -- then when EL submits a new order, C2 gets real confused. just be safe and issue a manual "closeallpositions" command when MarketPosition[1] <> MarketPosition.

c) you can call the Collective2() function multiple times back to back. it will append to an existing signal file along the way.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #8 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Now the third and final step is placing the orders with C2. We need to read our signal.txt generated by the function, parse the URL's within, and hit them on the C2 server. Fortunately, it is as easy as hitting a specific URL.

Using Wget for Windows (linked in first post) and this batch file (create a new file called "submit.cmd" in your Documents\MultiCharts\Collective2 directory), we'll scan for a new signal.txt file once per second and if found we'll move it temporarily, process it, then delete it and loop again starting over.

 
Code
                            
@echo off

:loop
if exist signal.txt goto submit
:delay
ping 1.1.1.1 
-n 1 >nul
goto loop
:submit
ren signal
.txt submit.txt
"c:\program files (x86)\gnuwin32\bin\wget" --spider -i submit.txt
del submit
.txt
goto loop 
Some notes:

a) make sure the filename is right, this will match the function filename from the above post.

b) the ping 1.1.1.1 -n 1 >nul command is just a quick and dirty way to pause for about 1-2 seconds. if you want to slow the whole process down (why?), change -n 1 to -n 10 or -n 60 etc, the number is equal to about 1-2 seconds.

c) you might need to change the c:\program files (x86).... path depending on where you installed wget for windows.

d) the --spider option means don't download the result file. the -i submit.txt is our input file, which we temporarily renamed from signal.txt above (just in the unlikely event a new signal is generated in the < 1 second it takes to run our batch file)

e) remember to run the submit.cmd batch file and just leave it open or minimized on your desktop. if you don't run it, no signals will get submitted. you might want to just add it to your startup folder for windows to load on boot, otherwise just dont forget about it.

THE END!

What do you think? It may be a bit ghetto, but it works great. For the adventurous, the better alternative to this three step process would be for the function itself to call an external C++/C# DLL which uses the HttpWebRequest engine and eliminates the DOS command line/wget step. It would also be nice to directly parse the resulting XML file to ensure the signal was processed by c2.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #9 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Should mention in the function code you'll need to adjust all the "text(c2limit:0:2)" (and similar) based on how many digits your instrument has after the decimal. I'm not sure of an automatic way to do this, let me know. For CL it's 2 digits for instance.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #10 (permalink)
 Zoethecus 
United States of America
 
Experience: Advanced
Platform: NT
 
Posts: 1,149 since Aug 2009


So, this my provide for more accurate reporting of trades for the developer, but it won't have any bearing on a subscriber who uses C2 auto-trade correct? They will still be under lag and execution constraints because they are getting signals after the fact, correct?

If that's the case, then susbcriber slippage may actually increase from what C2 posts as exceuted trades and that is not a good thing.

Reply With Quote
 
(login for full post details)
  #11 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


Zoethecus View Post
So, this my provide for more accurate reporting of trades for the developer, but it won't have any bearing on a subscriber who uses C2 auto-trade correct? They will still be under lag and execution constraints because they are getting signals after the fact, correct?

If that's the case, then susbcriber slippage may actually increase from what C2 posts as exceuted trades and that is not a good thing.

No I don't really agree.

Most of the slippage is from the developer -> C2. If people are serious about trading a C2 strategy (end user), they will AutoTrade it with a broker, and the speed of that is near instant. C2 reports "realism" factor for trades, this is what the end user can expect to get using AutoTrade.

With my method above for EasyLanguage, you are sending orders to C2 that are limit orders including profit targets and stops, this results in far, far less slippage than by doing everything market at the time market touches price (like NT does by default).

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #12 (permalink)
Chepell
Russia
 
 
Posts: 2 since Feb 2010
Thanks: 0 given, 0 received

Mike, thanks for your work.
Can you give an example - how to use the Collective2 function to send the stop orders (for entry).


upd:
I'm sorry, I understood how to send the stop orders (for entry).
But I can not understand how to use the function SetStopLoss, SetBreakeven, SetProfitTarget, SetTrailing send orders to Coll2 with your function?

Reply With Quote
 
(login for full post details)
  #13 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Look at post #1 for the C2 Signal API link, find the function you need, and pass it to the easylanguage function I created as the "cmd" parameter. I did not implement all of them, but you can easily make changes.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #14 (permalink)
NicoVersailles
Versailles
 
 
Posts: 8 since Mar 2010
Thanks: 0 given, 0 received

Hello Mike and thank you for this fantastic work. I think that MC is one of the best tool in order to build strategies but it has less "connectivity" than MT4 for example.... So this interface is welcome!

Like Chepel, I don't know how to use "built-in" stops in my MC signal.

For example:

SetStopPosition;
SetPercentTrailing(25,5);

Do I put:
Value1 = Collective2("signal"......
next after?

One more question, can I use forex mini contracts in C2 (i.e. 0.1 contract).

Thank u!!!!

Nicolas.

Reply With Quote
 
(login for full post details)
  #15 (permalink)
NicoVersailles
Versailles
 
 
Posts: 8 since Mar 2010
Thanks: 0 given, 0 received

I saw in C2 pages that an Email Signal Entry System is available.

I think that an integration with MC is possible (with alert email).

Is this solution too much slow or is it possible?

Reply With Quote
 
(login for full post details)
  #16 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Post #7 shows code for setting stops with C2. You'll want to set them ahead of time like this code does to prevent slippage.

As for what C2 lets you trade, that is a question for C2, I can't speak to forex mini's.

As for email, that is much to slow. Using the method I've outlined the delay is about 5-7 seconds or so (90% on C2's side, so they could conceivably improve it one day). Email would be far worse, probably in the 1-2 minute range at best.

Personally I found 5-7 seconds acceptable since I am setting the order up ahead of time (targets/stops). It means there is some slippage on entry but not on exit, which was "good enough" for my use.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #17 (permalink)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
 
Posts: 263 since Sep 2010
Thanks: 440 given, 91 received

Multicharts to Collective2

I'm quite interested to try out Collective2 but I'm lost. I did try to download application using links from tread #1, but no success

I have my signal that are generated from Multicharts. I just don't understand the interface between them, even after reading all reply twice...

Any clarification trully appreciated

Martin
Montreal, Canada

Reply With Quote
 
(login for full post details)
  #18 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Take it one step at a time and tell me specifically/exactly what step you do not understand or where you have a problem.

BTW, this entire solution requires some computer knowledge, so if you are not a PC guru then this method is not for you.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #19 (permalink)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
 
Posts: 263 since Sep 2010
Thanks: 440 given, 91 received


Quoting 
BTW, this entire solution requires some computer knowledge, so if you are not a PC guru then this method is not for you

.


I did go trough again late last night and I do understand now the logic, but not the process

-- Multicharts orders to a file

-- Dos program loop to see change in the order files
If change then use the Internet adapter software to send an Internet request line using the info from the
orders text files.

I'm not a PC guru expert. I do succeed to achieve my goals, but with lot of work. I will try again soon or look with solution from TradeBullet

Many thanks Mike for you kind support and dedication to your forum

Reply With Quote
 
(login for full post details)
  #20 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,676 since Jun 2009
Thanks: 3,791 given, 4,512 received

There is 3 steps, on which one have you some problems ?

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
The following user says Thank You to sam028 for this post:
 
(login for full post details)
  #21 (permalink)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
 
Posts: 263 since Sep 2010
Thanks: 440 given, 91 received


Big Mike View Post
Take it one step at a time and tell me specifically/exactly what step you do not understand or where you have a problem.

BTW, this entire solution requires some computer knowledge, so if you are not a PC guru then this method is not for you.

Mike

Hello Sam

I will put this project on the side for some time.

I realise that, even if my strategy is interesting and return very nice profit for the last 12 months, I still have work to do on it. I got extended periods with gain floating around a profit level. This could be discouraging if someone entered in the strategy at this period.

Also, the project for an external server will have to be process first.

Martin

Reply With Quote
 
(login for full post details)
  #22 (permalink)
NicoVersailles
Versailles
 
 
Posts: 8 since Mar 2010
Thanks: 0 given, 0 received

Hello everybody!

I've got problem to implement the "xreplace" C2 function, which replaces the SL for example; but to do that, we need a "signal stop ID" which is given by a response-xml to our first order (signal). So my autostrat can't know it...
My SL often changes so I'm a bit lost with this.

MC says that they will implement C2 in their code but no deadline...

any idea?

Thank u all.

Reply With Quote
 
(login for full post details)
  #23 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


NicoVersailles View Post
Hello everybody!

I've got problem to implement the "xreplace" C2 function, which replaces the SL for example; but to do that, we need a "signal stop ID" which is given by a response-xml to our first order (signal). So my autostrat can't know it...
My SL often changes so I'm a bit lost with this.

MC says that they will implement C2 in their code but no deadline...

any idea?

Thank u all.

You would need something more elaborate than what I provided to read the response file. wget is storing the response file, so it's just a matter of reading/parsing the data. I'm not sure if there is an EasyLanguage function to read from a text file or not, but if so, shouldn't be too hard from there.

Another approach would be to handle that part via dos command line instead of easylanguage entirely, just keeping the signal ID outside of easylanguage and knowing that when you do a xreplace, you need to provide it. Just need some basic dos scripting or windows powershell.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #24 (permalink)
 bomberone1 
London
 
Experience: Beginner
Platform: MultiCharts
 
Posts: 240 since Nov 2010
Thanks: 10 given, 23 received

Do you ask at team of collective2 or mujlticharts in project managment to implement thisd feautures?

I think that is better interface certificated by multicharts than own code.

Reply With Quote
 
(login for full post details)
  #25 (permalink)
Simon Li
China
 
 
Posts: 1 since Jun 2011
Thanks: 1 given, 0 received

Hi Big Mike,
Learn from Stan of MC that you've developed the interface, can you send me a copy ?
Currently I have a test system in Collective 2.

Thanks !

Reply With Quote
 
(login for full post details)
  #26 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


Simon Li View Post
Hi Big Mike,
Learn from Stan of MC that you've developed the interface, can you send me a copy ?
Currently I have a test system in Collective 2.

Thanks !

Everything is posted in this thread.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #27 (permalink)
 gpw797 
Mesa, AZ
 
 
Posts: 55 since Oct 2010

starting to play with this and have a couple questions. Mainly don't understand the first part or function code part..

1) The function code.. is this C or easylanguage? What does file get saved as including extension? Not sure how MC accesses this
2) The code shows up here with "winks" and cut and pasting the code is creating problems I think.. also there are spaces where there shouldn't be spaces I think. Can you please post as an attachment?

Reply With Quote
 
(login for full post details)
  #28 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

1. All EasyLanguage. For the function, you go to PowerLanguage editor and do New - Function. For strategy signal, you do new - signal.

2. The winks is a bug, and I am waiting for a fix. For now, you can replace winks with ), or if you reply to my post w/the code, you should be able to see the code as was intended w/o the smiley markup. I can't attach as a PLA because I no longer have this version of the code on my system.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #29 (permalink)
 gpw797 
Mesa, AZ
 
 
Posts: 55 since Oct 2010

replying with code to see code correctly w/o winks.

// Big Mike Trading https://futures.io/
// Apr 5 2010

{ C2 Signal Entry API }

{
Parameter Value or Example What it Means Comments
cmd= signal
systemid= 123456 The system ID displayed as above.
pw= loginPassword case sensitive
action= BTO Buy To Open open a long position
SSHORT Sell Short used for stocks
STO Sell To Open used for non-stocks
BTC Buy To Close close a short positio n
STC Sell To Close close a long positio n
quant= 100 Number of shares or contracts
instrument= stock Note that ETFs like QQQ and DIA are traded on a stock exchange and thus are considered stocks.
option
future
forex
symbol= IBM You are responsible for looking up your own symbols. If you trade Forex, you know that Collective2 figures out Forex symbol s automatically when you manually enter trades on the Web site. However, you'll need to enter already-valid symbols when using the Web service interface .
limit= 35.06 Only use if this is a l imit order.
stop= 20.10 Only use if this is a st op order. For market orders, do not use either sto p or limit parameters.
duration= DAY Day Order
GTC Good Til Cancel

}

{
The URL is in the following format:

https://www.collective2. com/cgi-perl/signal. mpl?[PARAMETERS]
}

inputs:
cmd ( StringSimple , { signal, closeallpositi ons }
systemid ( NumericSimple , { c2 system id }
pw ( StringSimple , { c2 password for said id }
action ( StringSimple , { BTO, SSHORT, STO, B TC, STC }
quant ( NumericSimple , { order quantity }
instrument ( StringSimple , { stock, option, future, forex }
c2symbol ( StringSimple , { symbol for instru ment }
c2limit ( NumericSimple , { optional }
c2stop ( NumericSimple , { optional buy s top/sell stop }
c2target ( NumericSimple , { target price, 0 for none, use with stoploss for OCO }
c2stoploss ( NumericSimple , { stop loss pric e, 0 for none, use with target for OCO }
duration ( StringSimple ; { DAY, GTC }

vars:
result ( 0 ,
filename ( "C:\Users\Mike\Documents\MultiCharts\Collective2\si gnal.txt" ,
c2baseurl ( "http://www.collective2.com/cgi-perl/signal.mpl?" ,
c2query ( "null" ;


if cmd = "signal" then begin
c2query = text(c2baseurl, "cmd=", cmd, "&systemid=", systemid:0:0, "&pw=", pw, "&action=", action, "&quant=", quant:0:0, "&instrument=", instrument, "&symbol=", c2symbol, "&duration=", duration);

if c2limit > 0 then c2query = c2query + "&limit=" + text(c2limit:0:2);
if c2stop > 0 then c2query = c2query + "&stop=" + text(c2stop:0:2);
if c2target > 0 then c2query = c2query + "&profittarget=" + text(c2target:0:2);
if c2stoploss > 0 then c2query = c2query + "&stoploss=" + text(c2stoploss:0:2);
end;

if cmd = "closeallpositions" then begin
c2query = text(c2baseurl, "cmd=", cmd, "&systemid=", systemid:0:0, "&pw=", pw);

end;

if GetAppInfo(aiRealTimeCalc) = 1 then FileAppend( filename,c2query + newline);
Text_New(date, time, C, text("c2: ", cmd, action, quant:0:0));
if c2target > 0 then Text_New(date, time, c2target , text("c2: target ", c2target:0:2));
if c2stoploss > 0 then Text_New(date, time, c2stop loss, text("c2: stop ", c2stoploss:0:2));

Reply With Quote
 
(login for full post details)
  #30 (permalink)
 gpw797 
Mesa, AZ
 
 
Posts: 55 since Oct 2010

Having trouble getting my strategy to compile with the code


If marketposition = 0 then begin

If dma > dma[1] and condition99 then begin//buy contractsize contracts next bar at market;
Value1 = collective2("signal", c2id, c2pw, "BTO", 1, "future", "QCLQ1", 0, 0, (Close + (100 * MinMove/PriceScale)), (Close - (100 * MinMove/PriceScale)), "DAY");
end;

If dma < dma[1] and condition99 then begin //sellshort contractsize contracts next bar at market;
Value1 = collective2("signal", c2id, c2pw, "STO", 1, "future", "QCLQ1", 0, 0, (Close + (100 * MinMove/PriceScale)), (Close - (100 * MinMove/PriceScale)), "DAY");
end;

end;

getting error message

------ Compiled with error(s): ------
Types are not compatible
errLine 120, errColumn 0, errLineEnd 120, errColumnEnd 0
causal study: (Function)

line 120 is the value1... line

any idea what I am doing wrong here?

Reply With Quote
 
(login for full post details)
  #31 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


gpw797 View Post
any idea what I am doing wrong here?

Did you create the Function and name it collective2? If you named it something else, you need to adapt the code.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #32 (permalink)
 gpw797 
Mesa, AZ
 
 
Posts: 55 since Oct 2010

I compiled Collective2 as a type string.. changed to numeric and it works so far (generates the text file).. now to work on the wget part, thanks. You still have a C2 strategy going Big Mike?

Reply With Quote
 
(login for full post details)
  #33 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


gpw797 View Post
You still have a C2 strategy going Big Mike?

No, I only created a c2 account for a futures.io (formerly BMT) project.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #34 (permalink)
 bomberone1 
London
 
Experience: Beginner
Platform: MultiCharts
 
Posts: 240 since Nov 2010
Thanks: 10 given, 23 received

I try to work on code on this topic to send a screenshot of a chart when a signal is generated, but nothing.
I find easy under metatrader:
WindowScreenShot("shots.gif",640,480);
SendFTP("shots.gif",NULL);
FileWrite()
SendFTP()
FileAppend

Is there any trick to publishing on website a image file of multicharts when a signal is generated?

Reply With Quote
 
(login for full post details)
  #35 (permalink)
 bomberone1 
London
 
Experience: Beginner
Platform: MultiCharts
 
Posts: 240 since Nov 2010
Thanks: 10 given, 23 received

Please vote this feauters request on mc pm.
MultiCharts Project Management - Issue MC-500 - Multichart web publishing a image of chart
My best.

Reply With Quote
 
(login for full post details)
  #36 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received

Please also make a new thread to continue that discussion, it is off-topic for this thread which is about Collective2.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #37 (permalink)
 gpw797 
Mesa, AZ
 
 
Posts: 55 since Oct 2010

Been using this system for a week and it works well. Just remember if you reload chart or strategy it will generate all signals again so be sure you don't have wget on when you do this. When starting up... load chart and strategy, delete existing signal.txt file then start wget. Thanks big mike!

Reply With Quote
 
(login for full post details)
  #38 (permalink)
 bomberone1 
London
 
Experience: Beginner
Platform: MultiCharts
 
Posts: 240 since Nov 2010
Thanks: 10 given, 23 received

Folks I don't want to be off topic.
I try to use the function of collective2 to write a line of mi signal on a free website built on joomla.
I don't find a solution how to send.
A boys tell me to write a dll for image but it's is the same to publishing a single line on a web page of joomla?

Reply With Quote
 
(login for full post details)
  #39 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


bomberone1 View Post
Folks I don't want to be off topic.
I try to use the function of collective2 to write a line of mi signal on a free website built on joomla.
I don't find a solution how to send.
A boys tell me to write a dll for image but it's is the same to publishing a single line on a web page of joomla?

Create a new thread -- this is off-topic.

On your new thread, post all of your code so far.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #40 (permalink)
 Fu510n 
Suffield, CT
 
Experience: Advanced
Platform: MultiCharts, TS, Python
Broker: IB, IQFeed, TS, Kraken
Trading: ES, NQ, RTY, YM, CL, RB, 6E
 
Fu510n's Avatar
 
Posts: 116 since Oct 2009
Thanks: 826 given, 116 received

Given that my current MC8 automated strategy involves scalping the 6E (Perry-like but using HMAs and a bit of other "discretionary logic"), I've added implementing a HttpWebRequest C++ DLL to my TODO list to streamline this process somewhat. I thought about going the C# route, but didn't want to deal with CLR overhead.

In the interest of time though (and given I'm using IB/TWS), I'm trying HighPowerBear (HPB) Signals ( Software) until I have the DLL finished. No affiliation, just kicking the tires...

-Guy

p.s. I'll eventually post the C++ DLL (with source/docs) here.

Follow me on Twitter Reply With Quote
The following user says Thank You to Fu510n for this post:
 
(login for full post details)
  #41 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
 
Posts: 292 since Dec 2009
Thanks: 243 given, 110 received


Big Mike View Post
I should also add that my method supports limit orders, stop orders (for entry), profit targets and stops (stop loss).

This is a big improvement over the limited functionality built-in to NinjaTrader with C2, as NT only submits market orders as they are filled.

With my function you can submit your profit target and stop loss orders, which are OCO, at the time of entry. You can also specify a limit order or a buy stop ahead of time to prevent slippage, which is a big issue with C2 systems in a volatile market.

Mike

Not sure what has changed between 2010 and 2014.

Right now, I have been told that from the C2 Signal Entry API, limit orders would be monitored for 1 second and then if limit not filled (as in pierced through ?) out of their datafeed (which in fact is DTN IQFeed) changed to market orders for signals tracking.
Are all orders out of C2 NinjaTrader integration still forwarded as market orders only ? Or do the pending Ninja limit orders waiting as real limit orders, and changed to market orders for C2 tracking only if touched but not filled after 1 second ?
In other words, is it still worth to build a "bridge" between Ninja and C2 using the web entry API like BigMike did for MultiCharts back in the days, or is it pointless with no additional advantage to attain ?

Reply With Quote
 
(login for full post details)
  #42 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
 
Posts: 292 since Dec 2009
Thanks: 243 given, 110 received

Using the Signal API, how long does it take for my orders to be updated on C2 for my investors to properly follow ? Few seconds ? how many ?

By the way, an alternate site is popping : c2pro.com
You get 6 months free if agreeing to beta-test it.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > EasyLanguage Collective2 Interface (MultiCharts to Collective 2)


Last Updated on June 8, 2014


Upcoming Webinars and Events

NinjaTrader Indicator Challenge!

Ongoing

Journal Challenge w/$1,800 in prizes!

May 7

The Cold Hard Truth: Maybe I Am Not Good Enough w/Chris Gray @ Earn2Trade

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts