Is there a way to auto-reload an EFS? Maybe every bar or every other bar? Or maybe a way to create an icon that you can link to an EFS for reload? It would help clean up false signals on the chart
The ability to reload a formula via an EFS function may be added to a future release. To quickly reload your formula for now, simply right-click on your chart and select "Reload." Then select the formula you wish to reload.
Jason K.
Project Manager eSignal - an Interactive Data company
Garth-
For example an MACD EFS that draws an up or down line when the signal line is crossed. At the bar of crossing you get multiple up/down arrows as the MACD tries to figure out what it is going to do. Only after reloading on the next bar (or sometimes several after) do you get the true direction. The result is a bunch of false signals that can only be cleared up by reloading. I was asking if there was a way to auto reload the EFS or create an icon that you can hit every so often to get the correct reading. How do other people deal with this?
1) Don't draw any arrows until NEWBAR
2) If you want the signal arrows before the bar close, then
keep track of all the unique labels you are writing for that bar and delete them using those labels.
I understand point 1. but I do want the sign as early as possible, even if the first signal is not the correct one. (at least I know it is close to crossover). I don't understand point 2?
but all I'm looking for is a more streamline way to reload.
1) Don't draw any arrows until NEWBAR
2) If you want the signal arrows before the bar close, then
keep track of all the unique labels you are writing for that bar and delete them using those labels.
I have done something close to this by doing the following -
if getbarstate()==new_bar bar=bar+1
drawstuf(...,bar)
This way only one image is drawn per bar and the chart does not get cluttered up with many images superimposed on top of on another, which could happen without the getbarstate check.
When you draw lines, shapes, etc (via Drawxxx()) in EFS you are supposed to generate a unique label for them (the last parameter I think). These labels can be used to delete these lines/shapes/images via removeXXX().
So DrawLine() would would use removeLine(), etc. removeXXX() has a single paramter which is the unique label used when creating the line.
Got it, thanks. I guess I'll have to see if this works in real time, but if I'm understanding this newbar state, does this mean that the first time something is drawn it is then passed over? What if the first signal is wrong?
David's MOD did solve the problem of multiply arrows being drawn, however it still doesn't solve the false signal problem. On 5 min charts for example the MACD may cross (giving a signal) at the open but by the close of the bar it has not re crossed and the trend continues, so if I didn't "reload" the MACD X EFS I would not have know this (unless I have the MACD indicator up) So, what I'm looking for is a routine or something that will reload an EFS at the end of each bar?
You are running your script in RT - thus, when the indicator reaches your entry condition - the arrow is drawn - right??
I have overcome this problem using a couple of tricks...
1. Change your EFS to ...
setComputeOnClose(true);
and adjust your indicators to look one bar back (-1).
2. Use a "Time-Stamp" to find out if the previous bar has closed (finished). Time-Stamps are simple... you declare a variable (ie:EntryTriggerTime = 0, then check the current bar's time against your last recorded time. This allows you to execute one entry trigger (or any action) for any bar...
example..
var EntryTriggerTime = 0;
function main()
{
if ((getCurrentBarIndex() == 0) && EntryTriggerTime != getValue("rawtime",-1))) {
// Current RT Bar.
if ((YourEntrySignal)() {
// Check the previous bar's indicators for your entry trigger and check to verify if we had not issued a previous trigger on that bar.
}
// Record the new trigger entry date.
EntryTriggerTime = getValue("rawtime",-1))
}
}
This should stop your code from triggering an entry signal as the market moves and wait for the bar to complete, then check for the entry trigger, then wait for the next new bar...
Comment