NexusFi: Find Your Edge


Home Menu

 





Need help with understanding simple EL code


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one kevinkdog with 2 posts (1 thanks)
    2. looks_two dubi with 2 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 solotrader with 1 posts (1 thanks)
    1. trending_up 1,145 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Need help with understanding simple EL code

  #1 (permalink)
dubi
Switzerland
 
Posts: 2 since Mar 2015
Thanks Given: 1
Thanks Received: 1

Hello everyone
This is my first post here and I hope this is the correct sub-forum to addess this. I have been studying various EL introductions but I did not get clarity on some statements.
I am trying to understand some EL-Code in order to translate this to my platform. Since I don’t have access to TS to test things out I am reaching out here.
The code is about as follows:

 
Code
If marketposition >= 0 then begin
	Sell short  (“s1) 1 contract next bar at p1 stop
End
I am reading the above as follows:
if there is no position or current position is long then
enter a short position of one contract as soon as the next bar starts but only if the price is at least as low as p1.
So it will not execute an order in the current bar, right?

Is it also correct that the order remains active until price<=p1? Meaning even if the condition price<=p1 is only met 10 bars later?

Thank you
dubi

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
17 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #3 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,662 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,351



dubi View Post
Hello everyone
This is my first post here and I hope this is the correct sub-forum to addess this. I have been studying various EL introductions but I did not get clarity on some statements.
I am trying to understand some EL-Code in order to translate this to my platform. Since I don’t have access to TS to test things out I am reaching out here.
The code is about as follows:

 
Code
If marketposition >= 0 then begin
	Sell short  (“s1) 1 contract next bar at p1 stop
End
I am reading the above as follows:
if there is no position or current position is long then

enter a short position of one contract as soon as the next bar starts but only if the price is at least as low as p1.

So it will not execute an order in the current bar, right?

Is it also correct that the order remains active until price<=p1? Meaning even if the condition price<=p1 is only met 10 bars later?

Thank you
dubi

if there is no position or current position is long then

enter a short position ORDER of one contract as soon as the next bar starts - to sell short if the price of the next bar is at p1 or below. This order will be active for the entire next bar. If it does not fill during the next bar, it will not renew the order for the next bar unless the condition is evaluated as true again.

So, if this is your whole code, if the order is not filled that next bar, at the end of that bar the code will be reevaluated, and since marketposition is still >=0, the order would be resubmitted.

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
dubi
Switzerland
 
Posts: 2 since Mar 2015
Thanks Given: 1
Thanks Received: 1

That was really speedy - thank you very much!!

This is exactly the clarity I was looking for. Really appreciate your support!

dubi

Reply With Quote
Thanked by:
  #5 (permalink)
 solotrader 
Cyprus
 
Posts: 68 since Jul 2013

Also note that the order will be filled at market if price is below p1. You may want to think about this if you are dealing with daily bars. Maybe you need a stop-limit order.

Reply With Quote
  #6 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,662 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,351


solotrader View Post
Also note that the order will be filled at market if price is below p1. You may want to think about this if you are dealing with daily bars. Maybe you need a stop-limit order.

That is a good point, if there is a opening gap. The strategy backtest will show a fill at the open price in this case.

In actual trading, though, the order will be rejected at the broker, since you can't enter sell stop orders that are above the market.

Follow me on Twitter Reply With Quote




Last Updated on October 24, 2015


© 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