NexusFi: Find Your Edge


Home Menu

 





Help with Strategy Dev in MC


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one Zhorny with 5 posts (0 thanks)
    2. looks_two Bimi with 4 posts (0 thanks)
    3. looks_3 NW27 with 3 posts (1 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 5,365 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 13 posts
    2. attach_file 1 attachments




 
Search this Thread

Help with Strategy Dev in MC

  #1 (permalink)
 Zhorny 
London
 
Experience: Master
Platform: NinjaTrader
Trading: FX
Posts: 10 since Oct 2012
Thanks Given: 0
Thanks Received: 0

Hi there,

I have very little experience in programming and want to create a very simple trading strategy in MultiCharts.

BUY = If Close (0) > Close (-1) -- buy if close of the current bar is greater than the close of the previous bar AND keep buying if this rule continues i.e. if there are 5 bars in a row each with the close higher than the previous bar then you will have a net LONG 5 lot position.

SELL = If Close (0) < Close (-1) -- sell if close of the current bar is less than the close of the previous bar AND keep selling if this rule continues i.e. if there are 5 bars in a row each with the close lower than the previous bar then you will have a net SHORT 5 lot position.

CLOSE entire LONG position when a SELL signal appears and open a SHORT as per the rule
CLOSE entire SHORT position when a BUY signal appears and open a LONG position as per the rule

I've highlighted two examples in the attached screenshot of how this rule should work.

Default Quantity = 1 lot i.e. every time I open or add to a current position I will only trade 1 lot.

When a reverse signal comes into effect i.e. "Close Longs - Open Short" I would sell off my entire long position and then open 1 position short.

Feedback appreciated.
Thank you

Attached Thumbnails
Click image for larger version

Name:	Example.png
Views:	194
Size:	9.1 KB
ID:	93726  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Are there any eval firms that allow you to sink to your …
Traders Hideout
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
ZombieSqueeze
Platforms and Indicators
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #2 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


Zhorny View Post
Hi there,

I have very little experience in programming and want to create a very simple trading strategy in MultiCharts.

BUY = If Close (0) > Close (-1) -- buy if close of the current bar is greater than the close of the previous bar AND keep buying if this rule continues i.e. if there are 5 bars in a row each with the close higher than the previous bar then you will have a net LONG 5 lot position.

SELL = If Close (0) < Close (-1) -- sell if close of the current bar is less than the close of the previous bar AND keep selling if this rule continues i.e. if there are 5 bars in a row each with the close lower than the previous bar then you will have a net SHORT 5 lot position.

CLOSE entire LONG position when a SELL signal appears and open a SHORT as per the rule
CLOSE entire SHORT position when a BUY signal appears and open a LONG position as per the rule

I've highlighted two examples in the attached screenshot of how this rule should work.

Default Quantity = 1 lot i.e. every time I open or add to a current position I will only trade 1 lot.

When a reverse signal comes into effect i.e. "Close Longs - Open Short" I would sell off my entire long position and then open 1 position short.

Feedback appreciated.
Thank you

do you expect someone to write it for you?

Reply With Quote
  #3 (permalink)
 Zhorny 
London
 
Experience: Master
Platform: NinjaTrader
Trading: FX
Posts: 10 since Oct 2012
Thanks Given: 0
Thanks Received: 0


Cheers for your super constructive feedback.
All I was after were a few pointers on how to code BUY and SELL orders etc.

Started this thread Reply With Quote
  #4 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


Zhorny View Post
Cheers for your super constructive feedback.
All I was after were a few pointers on how to code BUY and SELL orders etc.

have you read the manual?
have you given anything a try?

Reply With Quote
  #5 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,175
Thanks Received: 101,539

I no longer use MC, but some basics are covered here:



Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


Zhorny View Post
Cheers for your super constructive feedback.
All I was after were a few pointers on how to code BUY and SELL orders etc.



I am not trying to be hash, but seriously, if you want help, you have to show a little bit effort too.

Reply With Quote
  #7 (permalink)
 Zhorny 
London
 
Experience: Master
Platform: NinjaTrader
Trading: FX
Posts: 10 since Oct 2012
Thanks Given: 0
Thanks Received: 0

I have only gotten this far but do not know if it is a) correct or b) how to close off positions:

inputs: Quantity( 1 );

condition1 = Close > Close[1]
condition2 = Close < Close[1]

if condition1 then
buy ( "BTO" ) Quantity next bar at market;

if condition2 then
sell next bar at market

end;

if condition2 then
sellshort ( "STO") Quantity next bar at market;

if condition1 then
buytocover next bar at market

end;
end;


I get an error after compiling:
syntax error, expecting 'bars'
errLine 4, errColumn 0, errLineEnd 4, errColumnEnd 0
causal study: (Function)

Started this thread Reply With Quote
  #8 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


Zhorny View Post
I have only gotten this far but do not know if it is a) correct or b) how to close off positions:

inputs: Quantity( 1 );

condition1 = Close > Close[1]
condition2 = Close < Close[1]

if condition1 then
buy ( "BTO" ) Quantity next bar at market;

if condition2 then
sell next bar at market

end;

if condition2 then
sellshort ( "STO") Quantity next bar at market;

if condition1 then
buytocover next bar at market

end;
end;


I get an error after compiling:
syntax error, expecting 'bars'
errLine 4, errColumn 0, errLineEnd 4, errColumnEnd 0
causal study: (Function)


you need a semi-colon behind each statement.

Reply With Quote
  #9 (permalink)
 Zhorny 
London
 
Experience: Master
Platform: NinjaTrader
Trading: FX
Posts: 10 since Oct 2012
Thanks Given: 0
Thanks Received: 0

Making progress and I think I've got it after using the Repeat function although I'm still not sure it'll work.
I get an error that I have no idea what it means and don't see the problem (line 8 is the "buy("BTO")..." line).

Help appreciated.

------ Compiled with error(s): ------
Orders cannot be inside a loop.
errLine 8, errColumn 5, errLineEnd 8, errColumnEnd 5
causal study: (Function)




Quoting 
inputs: Quantity( 1 );

condition1 = Close[0] > Close[1];
condition2 = Close[0] < Close[1];

Repeat
if condition1 then
buy ( "BTO" ) this bar on close;
Until condition2;

if condition2 then
sell ( "STC" ) this bar on close;

Repeat
if condition2 then
sellshort ( "STO" ) this bar on close;
Until condition1;

if condition1 then
buytocover ( "BTC" ) this bar on close;


Started this thread Reply With Quote
  #10 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188


Repeat
.......
Until
Is a loop. You can't put orders inside here.
Remember that this code is processed on EVERY incoming tick, so you would have purchase 1000's

Regards,
Neil.

Reply With Quote




Last Updated on November 5, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts