Plot only once help - MultiCharts | futures.io
futures io futures trading


Plot only once help
Started: by olobay Views / Replies:180 / 5
Last Reply: Attachments:2

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Reply
 
Thread Tools Search this Thread
 

Plot only once help

  #1 (permalink)
Elite Member
Montreal
 
Futures Experience: Intermediate
Platform: MultiCharts
Broker/Data: IB Canada/IQFeed
Favorite Futures: TF, CL
 
olobay's Avatar
 
Posts: 249 since Jul 2011
Thanks: 278 given, 319 received

Plot only once help

Hi,

I have this Show Me code that I would like to plot only once, only the first time the conditions are met. Or if the last plot was a "Buy" plot, then the next plot can only be a "Sell" plot. So it would alternate between one plot for a sell and the next plot for a buy and then the next plot would be a sell. But I think it would be easier if the code would just plot it once the first time the conditions are met. Any help is appreciated.

 
Code
input: offset(.05);

variables: Range(0);

Range=(Open + Close) /2;

if close of Data2 >= Range of Data1 then
	begin
	Plot1( Low - offset, "Buy") ;
	end
	Else Begin
	NoPlot(0);
	end;
	
if close of Data2 <= Range of Data1 then
	begin
	Plot1( High + offset, "Sell") ;
	end
	Else Begin
	NoPlot(0);
	end;

Attached Thumbnails
Plot only once help-no-plot.png  
Reply With Quote
 
  #2 (permalink)
Elite Member
Milan (Italy)
 
Futures Experience: Advanced
Platform: TradeStation, MC, TWS
Broker/Data: TradeStation, IB
Favorite Futures: Futures, Forex
 
tradingest's Avatar
 
Posts: 81 since Dec 2014
Thanks: 4 given, 8 received

you can use Once to plot one time

Reply With Quote
The following user says Thank You to tradingest for this post:
 
  #3 (permalink)
Elite Member
Montreal
 
Futures Experience: Intermediate
Platform: MultiCharts
Broker/Data: IB Canada/IQFeed
Favorite Futures: TF, CL
 
olobay's Avatar
 
Posts: 249 since Jul 2011
Thanks: 278 given, 319 received


I tried the following but it only plotted the first time the condition happened on the chart. I don't think I was clear. I would like it to plot every time my condition is met, but only the first bar that it is met and not every single bar.

 
Code
input: offset(.05);

variables: Range(0);

Range=(Open + Close) /2;

once (close of Data2 >= Range of Data1)
	begin
	Plot1( Low - offset, "Buy") ;
	end;
	
once (close of Data2 <= Range of Data1)
	begin
	Plot1( High + offset, "Sell") ;
	end;
This is where I would like it to plot but only on the bars with arrows:

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #4 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received

olobay,

you could use a boolean variable that you check together with your condition. If your conditions are met, you will set the boolean to true as well. Now you just have to reset the boolean to false again in order to allow for a new plot - when you do that depends on when you want to allow another plot again (for example after X bars, when the conditions are not fulfilled anymore or with the opposite plot etc.).

 
Code
Variables:
haveBuyPlot ( false );

if close of Data2 >= Range of Data1 and haveBuyPlot = false then
	begin
        haveBuyPlot = true ;
	Plot1( Low - offset, "Buy") ;
	end;
Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #5 (permalink)
Elite Member
Montreal
 
Futures Experience: Intermediate
Platform: MultiCharts
Broker/Data: IB Canada/IQFeed
Favorite Futures: TF, CL
 
olobay's Avatar
 
Posts: 249 since Jul 2011
Thanks: 278 given, 319 received

Futures Edge on FIO

ABCTG View Post
olobay,

you could use a boolean variable that you check together with your condition. If your conditions are met, you will set the boolean to true as well. Now you just have to reset the boolean to false again in order to allow for a new plot - when you do that depends on when you want to allow another plot again (for example after X bars, when the conditions are not fulfilled anymore or with the opposite plot etc.).

Regards,

ABCTG

Thanks for the help. I understand in English what I need to do, but I have no idea how I should state it or where to place it in the code. I want to have only one bar with a dot and alternating dots, one for a sell and the next for a buy and the next for a sell again. This only plots once on the first occurrence on the chart.

 
Code
input: offset(.05);

variables: Range(0), haveBuyPlot(false), haveSellPlot(false);

Range=(Open + Close) /2;

if close of Data2 >= Range of Data1 and haveBuyPlot = false then
	begin
	haveBuyPlot = true ;
	Plot1( Low - offset, "Buy") ;
	end;
	
if close of Data2 <= Range of Data1 and haveSellPlot = false then
	begin
	haveSellPlot = true ;
	Plot1( High + offset, "Sell") ;
	end;

Reply With Quote
 
  #6 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received

olobay,

your code correctly does the first part of "If your conditions are met, you will set the boolean to true", you just need to do the second part "reset the boolean to false again [...] with the opposite plot". This is missing in the code and that's why you just get one plot for the very first occurrence at the moment.

In other words, when you set haveBuyPlot to true, you need to set haveSellPlot to false and vice versa. This will allow a new plot the next time your conditions are fulfilled.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:

Reply



futures io > > > > Plot only once help

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Mastering Trading Pysychology w/Brett Steenbarger & Trading Technologies

Elite only

PTMC Protrader Platform First Look w/Sergey Sokolov

Elite only

Spring Grains Outlook w/Sean Lusk @ Walsh Trading

Elite only

FIO Video Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

April

Process above all else w/Anthony Crudele @ Futures Radio Show

Elite only

Machine Learning - Quantitative Trading w/Martin Froehler @ Quantiacs

Elite only

Market Dynamics w/Peter Davies @ Jigsaw Trading

Elite only

Ask Me Anything w/Patrick Rooney @ Trading Technologies

Apr 18

Ask Me Anything w/FuturesTrader71

Apr 19

Machine Learning w/Kris Longmore

Elite only

Market Analysis w/Dave Forss

Apr 25

Introducing iSystems with Stage 5 Trading

Apr 27
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plot this! Pitrader EasyLanguage Programming 1 September 15th, 2015 12:55 PM
indicator will not plot MilfordT NinjaTrader 5 October 6th, 2014 06:46 PM
Overnight H L plot? keymoo NinjaTrader 8 May 1st, 2012 05:20 AM
Plot only if true Locust EasyLanguage Programming 3 October 27th, 2010 02:30 PM
Could you help me with this plot??? andaluz NinjaTrader Programming 2 May 30th, 2010 07:54 PM


All times are GMT -4. The time now is 04:20 AM.

no new posts
Page generated 2017-03-24 in 0.09 seconds with 20 queries on phoenix via your IP 54.145.208.160