NexusFi: Find Your Edge


Home Menu

 





Buy 1 Bar After Signal


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,512 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Buy 1 Bar After Signal

  #1 (permalink)
jkepha
San Antonio, TX
 
Posts: 31 since Apr 2020
Thanks Given: 10
Thanks Received: 6

Hello,

I'm trying to get my strategy to buy at the close of that bar and not the open. Can anyone assist? To put in another way, its buying at the close of the bar after the initial change of brick colors. I can't figure this out. Might seem silly, but I think it will give me a moe accurate back test.

Here is screen shot. Thanks for any help!!


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Hello jkepha,

you could store the bar number in a variable (let's call it longTriggerBar in this example; and I'd suggest using separate variables for long and short) when your entry conditions are true. Then you can issue your orders when CurrentBar +1 = longTriggerBar and use "this bar on Close" instead of "next bar at market" in the command. However, please keep in mind that in real time a "this bar on Close" order would not be a market on Close order, but get filled around the open of the next bar.

Regards,

ABCTG


jkepha View Post
Hello,

I'm trying to get my strategy to buy at the close of that bar and not the open. Can anyone assist? To put in another way, its buying at the close of the bar after the initial change of brick colors. I can't figure this out. Might seem silly, but I think it will give me a moe accurate back test.

Here is screen shot. Thanks for any help!!



Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
jkepha
San Antonio, TX
 
Posts: 31 since Apr 2020
Thanks Given: 10
Thanks Received: 6


Hi ABCTG,

Thank you so much for the post!! I tried several iterations of that and could not get it to work. It keeps asking me for a numerical expression where the equal sign is. I tried a greater than, that didn't work either.

Anyway you could assist further?

Thank you sir.


Ryan

Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Hi Ryan,

I am sure someone on futures.io could steer you in the right direction and it might encourage help if you would post the full code (preferably within Code tags) that is giving you the compilation error you describe.

Regards,

ABCTG


jkepha View Post
Hi ABCTG,

Thank you so much for the post!! I tried several iterations of that and could not get it to work. It keeps asking me for a numerical expression where the equal sign is. I tried a greater than, that didn't work either.

Anyway you could assist further?

Thank you sir.


Ryan


Follow me on Twitter Reply With Quote
Thanked by:
  #5 (permalink)
jkepha
San Antonio, TX
 
Posts: 31 since Apr 2020
Thanks Given: 10
Thanks Received: 6

Hi,

Thanks very much for your response. I'm going to post it in here. Should I create a new thread?


<code>

Condition1 = c[0]>o[0] ;

Condition2 = o[0]>c[0] ;


if Condition1 then

Buy ( "Make Money" ) 1 Share next bar at market ;

if Condition2 then
Sell ( "Keep Money" ) 1 Share next bar at market ;

</code>



Thanks very very much,

Ryan

Reply With Quote
  #6 (permalink)
jkepha
San Antonio, TX
 
Posts: 31 since Apr 2020
Thanks Given: 10
Thanks Received: 6

Ok this is fixed.

Here it is if anyone needs it

<code>
{ Helpful instructions on the use of EasyLanguage, such as this, appear below and are
contained within French curly braces {}. There is no need to erase these
instructions when using EasyLanguage in order for it to function properly, because
this text will be ignored. }

{ STEP 1 OF 2: Replace <CRITERIA> with the criteria that will trigger a Buy at the open
of the next bar using a market order. }


Condition1 = c[0]>o[0] ;


Condition2 = o[0]>c[0] ;



{ STEP 2 OF 2: Replace "Entry Name" (leaving the quotes) with a short name for the
entry. The entry name will appear on the chart above/below the trade arrows and in
the trade by trade performance report. }

if Condition2 then Value1 = BarNumber;

if BarNumber > Value1 + 1 then

Buy ( "Free Money" ) 1 Share next bar at market ;


if Condition2 then
Sell ( "Keep Money" ) 1 Share next bar at market ;

</code>

Reply With Quote




Last Updated on June 5, 2020


© 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