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


Plot only once help
Updated: Views / Replies:209 / 5
Created: by olobay 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: 250 since Jul 2011
Thanks: 281 given, 321 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: 250 since Jul 2011
Thanks: 281 given, 321 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,288 since Apr 2013
Thanks: 203 given, 725 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: 250 since Jul 2011
Thanks: 281 given, 321 received


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,288 since Apr 2013
Thanks: 203 given, 725 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)

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

May

Prototyping Python Strategies (part 2) w/Ran Aroussi

Elite only

Ask Me Anything w/Raymond Deux @ NinjaTrader

May 3

An Afternoon with FIO member Softsoap

Elite only
 

Machine Learning & Data Mining Bias w/Kris Longmore @ Robot Wealth

Elite only

Brannigan Barrett (TBA)

Elite only

FIO member Gomi (TBA)

Elite only

FuturesTrader71 (TBA)

Elite only

EasyLanguage Programming w/Chris @ ABC Trading Group

Elite only

Portfolio Diversification w/Brendon Delate

Elite only
     

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 10:17 PM.

Copyright © 2017 by futures io, s.a. Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-04-30 in 0.09 seconds with 20 queries on phoenix via your IP 54.161.114.92