NexusFi: Find Your Edge


Home Menu

 





Trouble with buy code. Help/Ideas?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 5,767 views
    2. thumb_up 9 thanks given
    3. group 2 followers
    1. forum 20 posts
    2. attach_file 5 attachments




 
Search this Thread

Trouble with buy code. Help/Ideas?

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


Dallasboy View Post
Thanks ABCTG!
Still think there is something I am not yet thinking about.

Dallasboy,

you are welcome. You can add print statements to your code to check the value your variable has on ever bar.
This should give you some insights into what is going on internally.

Something like this might get you going:
 
Code
Print( DateTimeToString( DateTime ), "; BuyBelow: ", BuyBelow ) ;
Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:

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
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
26 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
22 thanks
My NQ Trading Journal
16 thanks
HumbleTraders next chapter
9 thanks
  #12 (permalink)
Dallasboy
dallas texas
 
Posts: 17 since Jan 2016
Thanks Given: 6
Thanks Received: 4

ABCTG,

Thanks and a great idea...never used this before. So inserted your code in mine and compiled, but not seeing anything new on the charts to check the variable on each bar. BTW I'm using MC.

Thanks!

Edit: I see it now in the output window...is there any way to put that in the data window on the chart? And how to expand the decimals? For exmaple, in the EUR it gives me outputs in 1.14 format, how to get it in 1.14000 ?

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


Dallasboy,

you would have to plot the values to make them visible in the data window, this won't work with a print.
Using plots is also a good way to make things visible on the chart - even values from a system, just look into the SetPlotValue and GetPlotValue reserved words.

You can find the various print options, including how to add more decimals in the Multicharts wiki.

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:
  #14 (permalink)
Dallasboy
dallas texas
 
Posts: 17 since Jan 2016
Thanks Given: 6
Thanks Received: 4

Hi ABCTG,

So I added this to the signal code:

i_setplotvalue(111, BuyBelow);
i_getplotvalue(111);

But when I try to plot (via a Plot1 function), it gives an error you can't plot from a signal study.

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

Dallasboy,

it's correct that you can't plot from strategies. That's why you can use i_setplotvalue in the strategy to send a value to an indicator on the same chart. The indicator has to use i_getplotvalue to access the value and you can plot this value then using a regular plot reserved word.
Plotting directly from the strategy will not work unfortunately.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #16 (permalink)
Dallasboy
dallas texas
 
Posts: 17 since Jan 2016
Thanks Given: 6
Thanks Received: 4


ABCTG View Post
Dallasboy,

it's correct that you can't plot from strategies. That's why you can use i_setplotvalue in the strategy to send a value to an indicator on the same chart. The indicator has to use i_getplotvalue to access the value and you can plot this value then using a regular plot reserved word.
Plotting directly from the strategy will not work unfortunately.

Regards,

ABCTG

OK, let me get this straight: I put a random indicator on my chart, and within that script I use the i_getplotvalue to retrieve the value from my signal script and then I can plot it either on the chart or data window?

Any chance on how this code would look like?

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

Dallasboy,

assuming you have this line added to your signal:
 
Code
i_setplotvalue(111, BuyBelow);
Then a simple one line indicator (simply create a brand new one, name it whatever you like) will do it:
 
Code
Plot1(i_getplotvalue(111), "BuyBelow");
Now you simply have to apply both to the same chart and it should work.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #18 (permalink)
Dallasboy
dallas texas
 
Posts: 17 since Jan 2016
Thanks Given: 6
Thanks Received: 4

Hi ABCTG,

Thanks for the help on plotting values! I'm still trying to figure out why sometimes the code doesn't seem to abide by the rules. Again, the way the buy works is to trigger on the value of BuyBelow which is setup and defined by the higher swing lows (see charts). I have keep IOG true and 1 in 4 or so setups does not trigger. In chart "buyissue", you can see 2 well defined buy setups and executions, with the third not triggering...AND, the BuyBelow value is valid and doesn't change.




So, I did turn off IOG and now trade #3 works (chart "buyissue2"), but IOG shouldn't matter in these trades as they setup 2+ bars after the higher swing (BuyBelow).




Again, thanks for your help and advice!

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

Dallasboy,

I am afraid one can only guess without going through your code and investing some time in debugging it.

As I have pointed out you can use the I_setplotvalue and I_getplotvalue reserved words to check the values that are used for the entries. You can also use Print statements to analyze situations in the code. Check the actual entry prices that are used for triggering the orders, check that the same order is not used again etc..
This will likely be the road you have to take to track the cause down.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #20 (permalink)
Dallasboy
dallas texas
 
Posts: 17 since Jan 2016
Thanks Given: 6
Thanks Received: 4


ABCTG,

Thanks for all your help. Looks like I found the bug...more to learn ;-)

Reply With Quote
Thanked by:




Last Updated on July 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