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,749 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #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?
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
MyForexFunds Begins Returning Frozen Funds After CFTC Ca …
Funded Trading Evaluation Firms
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,737 since Jul 2012
Thanks Given: 1,917
Thanks Received: 7,476



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 X 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,737 since Jul 2012
Thanks Given: 1,917
Thanks Received: 7,476


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 X Reply With Quote




Last Updated on October 24, 2015


© 2026 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 - Downloads - Top
no new posts