NexusFi: Find Your Edge


Home Menu

 





Syntax for capturing previous bid/ask in Easylanguage


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one mashficool with 3 posts (1 thanks)
    2. looks_two ABCTG with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Jura with 1 posts (1 thanks)
    1. trending_up 2,575 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Syntax for capturing previous bid/ask in Easylanguage

  #1 (permalink)
mashficool
columbus, GA
 
Posts: 7 since Jun 2016
Thanks Given: 4
Thanks Received: 3

I am brand new to EasyLanguage, so struggling to find a simple syntax.

Example below identifies he problem in detail:

Problem 1) I currently am looking at a 1 min chart window and see the price on @ESM16 go
from $2115.00 to $2114.75.

I am trying to code a logic that will identify the previous price of $2115.00 and current price of $2114.75 and put them in two different variables. Then compare the variables to see which one has a greater numeric value.

I know this is basic easy language stuff, but I am new to Easylanguage so please understand.

Regards,
Mash

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
 
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?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


Mash,

EasyLanguage code is executed from top to bottom, therefore you can save an old value before overwriting it like this:

 
Code
myOldValue = newValue ;
newValue = Close ;
Now the variable myOldValue will hold the value that was last stored (during the last code cycle) in newValue and newValue will hold the value that Close currently has.

You might also want to look into "intrabarpersist", what it does and if you might need it for your solution.
By the way you can show your appreciation for a post here on Futures.io using the "Thanks" button under it.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
mashficool
columbus, GA
 
Posts: 7 since Jun 2016
Thanks Given: 4
Thanks Received: 3


ABCTG View Post
Mash,

EasyLanguage code is executed from top to bottom, therefore you can save an old value before overwriting it like this:

 
Code
myOldValue = newValue ;
newValue = Close ;
Now the variable myOldValue will hold the value that was last stored (during the last code cycle) in newValue and newValue will hold the value that Close currently has.

You might also want to look into "intrabarpersist", what it does and if you might need it for your solution.
By the way you can show your appreciation for a post here on Futures.io using the "Thanks" button under it.

Regards,

ABCTG

ABCTG, your answer really helps. Thanks a bunch, but this puts another question in my mind.

The reserved word "Close", does it take the closing price of the previous bar? I think so right?

if so, then I need a strategy that picks up the previous price, whether it happened in the last minute or whether it happened in the last Nano second and not necessarily from the closing price from the previous bar.
Does intrabarpersist give me the ability to pick up that price that came immediately before the current price?

Also I need to figure out a way to capture the current price, compare this with previous price and then compute whether the price went Down 0.25 or went Up 0.25 (strictly monitoring the minimum price move "direction" for S&P Emini in 0.25 increments)

Maybe I can format my charts to "Kase Chart" and make the target value range as 0.25 ? Maybe this is not the right solution...I am confused here.

Thanks so much for helping!

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

mashficool,

sometimes it helps to print the values of a variable or reserved word to see what value it holds.
Close will return the last price a trade took place at.

That's why the code snippet I posted could be used to compare the last two ticks (or better the last two values close had while your code was executed) provided the two variables are intrabarpersist and your code is executed intrabar.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


mashficool View Post
The reserved word "Close", does it take the closing price of the previous bar? I think so right?

Yes, `Close` returns the closing price of a bar: `Close` returns the current bar's closing price, `Close[1]` of the previous bar, and `Close[2]` of the bar before that, and so on.

There's one exception to this, and that's when the bar that the script currently calculates on is still being updated (that is, it's a real-time bar and ticks are still incoming). In that case, `Close` refers to the current, most recent tick.


mashficool View Post
Also I need to figure out a way to capture the current price, compare this with previous price and then compute whether the price went Down 0.25 or went Up 0.25 (strictly monitoring the minimum price move "direction" for S&P Emini in 0.25 increments)

If you mean with 'price' the closing price, you can do that like:

 
Code
Variables:
  priceDifference(0);
  
priceDifference = Close - Close[1];

if (priceDifference = 0.25) then
  Print("Up 0.25 points")
else if (priceDifference = -0.25) then
  Print("Down one 0.25 price increment");

mashficool View Post
Maybe I can format my charts to "Kase Chart" and make the target value range as 0.25 ? Maybe this is not the right solution...I am confused here.

You may of course adjust your charts if you want to, but it's not needed per se since it can also be done with code (and so you can keep the chart like you want it).

Reply With Quote
Thanked by:
  #7 (permalink)
mashficool
columbus, GA
 
Posts: 7 since Jun 2016
Thanks Given: 4
Thanks Received: 3


Jura View Post
Yes, `Close` returns the closing price of a bar: `Close` returns the current bar's closing price, `Close[1]` of the previous bar, and `Close[2]` of the bar before that, and so on.

There's one exception to this, and that's when the bar that the script currently calculates on is still being updated (that is, it's a real-time bar and ticks are still incoming). In that case, `Close` refers to the current, most recent tick.


If you mean with 'price' the closing price, you can do that like:

 
Code
Variables:
  priceDifference(0);
  
priceDifference = Close - Close[1];

if (priceDifference = 0.25) then
  Print("Up 0.25 points")
else if (priceDifference = -0.25) then
  Print("Down one 0.25 price increment");

You may of course adjust your charts if you want to, but it's not needed per se since it can also be done with code (and so you can keep the chart like you want it).

Do I have to use Intrabarpersist = true in this code above that you gave me? or will it work without it? I am still learning the Intrabarpersist thingy in easylanguage.

When you write a script to take a position when certain conditions occur,
("if this = this and this.. then do that") how do you make sure the script does not keep taking new positions? is there a reserve word in easylanguage for that ? in ninjatrader topic here in this forum, I found the word to be EntriesPerDirection but such words does not exist in easylanguage..

Reply With Quote




Last Updated on June 11, 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