NexusFi: Find Your Edge


Home Menu

 





Options trading strategy


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 5 posts (0 thanks)
    2. looks_two todell826 with 5 posts (0 thanks)
    3. looks_3 Jura with 1 posts (0 thanks)
    4. looks_4 The9000 with 1 posts (0 thanks)
    1. trending_up 7,098 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 12 posts
    2. attach_file 0 attachments




 
Search this Thread

Options trading strategy

  #1 (permalink)
todell826
phoenix arizona usa
 
Posts: 5 since Jan 2016
Thanks Given: 0
Thanks Received: 0

Hello,

I'm new to powerlanguage and need a little help. I am creating an options vertical spread strategy. I have three charts set up in multicharts.

Data1 is my underlying stock
Data2 is my short option
Data3 is my long option

When my entry signal triggers in Data1, I want to:
sellshort data2 next bar at market and
buy long data3 next bar at market

This is the code so far
variables:
R1 (187),
R2 (190),
R3 (200),
S1 (170),
S2 (160),
S3 (150),
shorDeltaBull (.2),
shorDeltaBear (-.2),
DTE (45),
spread (1);


inputs: FastLength( 6 ), SlowLength( 19 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;

var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;

condition1 = var2 crosses over 0 ;
if condition1 then
Alert( "Bullish alert" )
else
begin
condition1 = var2 crosses under 0 ;
if condition1 then
Alert( "Bearish alert" ) ;
end;

if marketposition = 0
and currenttime > 0830
and Close > R1
and Close [1] > R1
and Close < R2
and var2 crosses under 0 then
sellshort 5 contracts data2 next bar at Market;


It give this error when compiling

Study: "Spy Crusher" (Signal)
Please wait ....
------ Compiled with error(s): ------
syntax error, unexpected 'data', expecting ';'
line 37, column 23

Is it possible in Multicharts to trade the different charts? What is the correct syntax?

Thanks for the help!!!!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


todell826,

you can only issue orders on Data 1, trading on additional datastreams is not possible unfortunately.
You might need to consider using two charts and using the underlying stock as data 2 while you are using the long option as data1 on the first chart and the short option as data 1 on the second chart.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
todell826
phoenix arizona usa
 
Posts: 5 since Jan 2016
Thanks Given: 0
Thanks Received: 0

How would I place a trade on the second chart? Modify the signal for the second chart to synchronize the trades?

// for the second chart
If marketposition = -1 then buy X contracts next bar at market

Thanks for the help!!!!

Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

todell826,

doesn't the stock symbol generate your trades? One assumption you could make would be that the same code using the same data generates signals on the two charts at the same time. So the two charts would be independent of each other.
If this isn't what you are looking for, you might be able to accomplish your goal using the Portfolio Trader or by synchronizing trade signals across the two charts via external DLLs.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
todell826
phoenix arizona usa
 
Posts: 5 since Jan 2016
Thanks Given: 0
Thanks Received: 0

Thanks ABCTG, I have been working with two similar charts and strategies to produce a credit spread when my signal hits. My problem now is I need to change the instrument in data1. It gives me a list of ten previous selections. How do you change data1 other than creating a new chart?

Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

todell826,

I am not sure if I understand exactly what you mean, as I am not aware of a list of previous selections in Multicharts that is for symbols. My guess would be that you are referring to the symbol list for a particular data provider and you are only seeing those that you added or that were pre-added. If that's the case simply add the symbols you are looking for, if not please elaborate what you mean and add a screenshot.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #8 (permalink)
todell826
phoenix arizona usa
 
Posts: 5 since Jan 2016
Thanks Given: 0
Thanks Received: 0

The underlying is data2. the option that is traded is data1. As price changes I need to change the strike price (change data1). The drop down in the data1 chart gives ten previous selections but the one I need is not in this list. I have not found a way to change it to something other than what is in that drop down. It probably cannot be done but I thought I would ask.

Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

See if you can add the symbols you need to the list: Data Sources Overview - MultiCharts

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #10 (permalink)
todell826
phoenix arizona usa
 
Posts: 5 since Jan 2016
Thanks Given: 0
Thanks Received: 0


Thanks for all the help!

I have another question.

When a position is opened in data1, how do you generate a variable that equals the bid price of data2 at the time of position entry?

Reply With Quote




Last Updated on March 7, 2016


© 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